Jquery Add Example - Jquery

How to add element to the existing group of elements in jquery?

Snippet Code


  
Rate this page :
  [ 1 votes]

This simple jquery code allows you to add the content p and span tag elements into an existing group of elements. The add example code is given below.

<script type='text/javascript'> $(document).ready(function(){ $("h1").add("span").add("p").css("color", "red"); }); </script> <h1>Welcome </h1> <span>To</span> <span>Hscripts</span> <p>!!!</p>

Tags


Ask Questions

Ask Question