create div element in jquery

In this programming tutorial you will learn how to create div element in jquery. I always says that jquery is the best javascript library to deal with DOM's element. So let's see the following code snippet that will do what we want.

create div element in jquery

$("

hello world

").appendTo("body");
If you want to create div in other element of page then first select the parent element with something like
$("#id") or $(".class")
then use the .append() function.
$("#elementID").append("
hello world
")
So that's it. I love your feedback.

0 comments: