jQuery Add Div To Body Examples

While working with different elements, especially divs and DOM manipulation,  there may have been times when you wanted to add a div to body of the web page? So do know how to add div to the html body of a web page using jQuery? If not, this article is for you. In this article, I am going to share very easy examples to use jQuery to add div to body.

How to use jQuery add div to body

Let’s assume that we have a web page  with the standard “body” in it. We would now like to add a div to this body. The following example shows you how to do it easily:

Example – Add a div to body using jQuery

When you run the above code, simply click on the Add button to add the div to body. To remove it, you can use the code associated with the Reset button.

Simple, isn’t it?

Do you know of any other ways to use jQuery to add div to body? Feel free to suggest by commenting below.

Share your thoughts, comment below now!



CommentLuv badge