Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • jQuery add() Method

    • 0
    • 0
    • 0
    • 0
    • 3
    • 0
    • 0
    • 0
    • 298
    Comment on it

    Hello Readers,


    We use add() method to add elements with a existing group of elements or selectors.


    Syntax: selector.add(selector)
    


    Parameters

    Please find the following description of all the parameters used by this add methods


    Selector It refer to a comma-separated list of selectors to select elements to be added. (e.g. add(".1class, .2class")).


    Here is the example of add() method.


    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery add method</title>
    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    </head>
    <body>
        <p>Hello, This is first Line!</p>
        <span>Hello Again, and this is the second line!!</span>
    <script="text/javascript">
    $( "p" ).css("color","#c00").add("span").css( "background", "yellow" );
    </script>
    </body>
    </html>
    

 3 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: