jQuery add() method Last Updated : 09 Sep, 2023 Comments Improve Suggest changes Like Article Like Report The jQuery add() method is used to add elements to the existing group of elements. This method can add element to the whole document, or just inside the context element if the context parameter is defined. Syntax: $(selector).add(element, context_parameter) Here selector helps to find the matching element. Parameters: It accepts two parameters that are specified below: element: It is the selected element.context_parameter: It is the context parameter of the element defined. jQuery code to show the working of add() method: HTML <!DOCTYPE html> <html> <head> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script> $(document).ready(function () { $(".heading").add("#para1").add("#span1"). css("background-color", "lightgreen"); }); </script> </head> <body> <p style="color:green" class="heading"> Welcome to GfG!!! </p> <p style="color:green" id="para1"> Welcome to GeeksforGeeks !!! </p> <span style="color:green" id="span1"> Article 1 !!!. </span> <div>This example adds the same css style for both "p" and "span" elements, using its class and id name!!! </div> </body> </html> Output: Comment More infoAdvertise with us K kundankumarjha Follow Improve Article Tags : Web Technologies JQuery jQuery-Methods Explore jQuery Tutorial 8 min read Getting Started with jQuery 4 min read jQuery Introduction 7 min read jQuery Syntax 2 min read jQuery CDN 4 min read jQuery SelectorsJQuery Selectors 5 min read jQuery * Selector 1 min read jQuery #id Selector 1 min read jQuery .class Selector 1 min read jQuery EventsjQuery Events 4 min read jQuery bind() Method 2 min read jQuery blur() Method 1 min read jQuery change() Method 2 min read jQuery EffectsjQuery animate() Method 2 min read jQuery clearQueue() Method 2 min read jQuery delay() Method 2 min read jQuery HTML/CSSjQuery addClass() Method 2 min read jQuery after() Method 1 min read jQuery append() Method 2 min read jQuery TraversingjQuery | Traversing 4 min read jQuery add() method 1 min read jQuery addBack() Method 2 min read Like