jQuery add() Method


jQuery add Method : Adds elements to the matched elements.


Syntax of jQuery Traversing – add() Method

$(selector).add(element,context);

Parameters :
element : One or more elements to be added in the matching selections.
context : Is optional. It is point of document from where selector should begin the matching.

jQuery add Method Example with syntax

<script type="text/javascript">
         $(document).ready(function(){         
             $("div").add(" p ").css("background","yellow");           
          });
</script>

Try it »


User Ans/Comments

📖 Read More


Advertisements