Creating a div element in jQuery
How do I create a
div
element in jQuery?solution:
First select the parent element with something like
$("#id"), $("element") or $(".class")
Then use the
.append("<div>foo</div>")
function. Alternatively, you can use the .html()
as mentioned in a different answer.$("#foo").append("<div>hello world</div>")
http://stackoverflow.com/questions/867916/creating-a-div-element-in-jquery