Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is jquery after() method ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 387
    Comment on it

    Hello Readers,

    jquery after() method is used to insert the given content after the specified each selected content or elements.

    Syntax :

    $(selector).after(content,function(index))
    

    content : this is required parameter which specifies the content to insert.

    function : this function is used to return the HTML after the content insert.

    Code Example :

    <!DOCTYPE html>
    <html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
        $("button").click(function(){
            $("p").after("<p>Hello world!</p>");
        });
    });
    </script>
    </head>
    <body>
    
    <button>Insert content after each p element</button>
    
    <p>This is a paragraph.</p>
    <p>This is another paragraph.</p>
    
    </body>
    </html>
    

    In the above code use the after() method and insert the HTML content after the each

    tag in jquery.

 0 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: