jquery, ajax

jquery appendTo with add class

이상욱1 2016. 2. 22. 14:16

http://lemeraldl.tistory.com/admin/entry/post


  1. $('<div id="mydiv"></div>').addClass('newClass').appendTo('body');

If you need to use .append() rather than .appendTo() you can also traverse from the body to #mydiv:

Copy code
  1. $('body').append('<div id="mydiv"></div>').find('#mydiv').addClass('newClass');