Search within TutorialsPark

Jquery Create New Elements

Learn to use jQuery to create new Elements.

jQuery DOM : Creating New Elements using $() Function

jQuery can be used to create new elements by passing an HTML fragment string to the $ function.

If a string is passed as a parameter to $() , jQuery examines the string ro see if it looks like HTML, then jQuery attempts to create new DOM elements as described by the HTML.

Example: Creating new Elements using $() function.

Give it a TRY! » Note: The actual creation of the element is handled by the browser's innerHTML mechanism.

jQuery DOM : Create New Element by Cloning Existing Elements

You can use jQuery to create new elements from existing elements by using the clone() method.

The clone() method is used in conjunction with one of the insertion methods, it is a convenient way to duplicate elements on a page.

Example: Create New Elements by Cloning Existing Elements

Give it a TRY! » Note:The last box is cloned to create a new box exactly the same as last.