Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use append() method in jQuery ?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 178
    Comment on it

    Welcome to findnerd, today we are going to discuss on append() method in jQuery.

    Firstly let know what use of append() method
    Append() method is used for inserting at the end of the selected elements in jQuery

    you can see bellow example how it work

    <!DOCTYPE html>
    <html>
    <head>
         <!--  here call the jquery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
        $("#btn").click(function(){
            $("p").append(" How are you ?");// call append() to add text
        });
    });
    </script>
    </head>
    <body>
      <!--  here write paragraf in which you want add text-->
    <p>Hi Joi</p>
     <!--define  button id -->
    <button id="btn">Submit</button>
    
    </body>
    </html>
    

    output will come following:

    when you will click on submit button then "How are you ?" will be add in your end of paragraf.

    Hi Joi How are you ?

 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: