jquery-theonlytutorials

Learn how to Create and Add new element in jQuery!

Here we are going to see how we can add a new element into the body of the page or inside particular div using jQuery.

Adding also called appending new html tag to the particular div. So, we have a function called append() in jQuery to do this trick.

See the below examples, This example show how you can append a new html element into the body of the page:

EXAMPLE 1 : Append an html element when page loads

Syntax:

This div is added through jQuery after the page loaded

Code Demo:

First div present already

EXAMPLE 2: Create an html Element after clicking a selector (here a tag):

This div is added through jQuery after the page loaded

Code Demo

Click here to add new element

First div present already

About the Author

agurchand

Software Engineer, Blogger etc., Visit my Youtube channel - <a href="http://www.youtube.com/agurchand">Click Here</a>

Leave a Reply

Your email address will not be published. Required fields are marked *