jQuery append() method

The append() method inserts specified content at the end of the selected elements and To insert content at the beginning of the selected elements, use the prepend()  method.

Syntex:

$(selector).append(content,function(index,html))

Example:1

<!DOCTYPE html>

<html>

<head>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

  <script>

$(document).ready(function(){

    $("#btn1").click(function(){

        $("p").append(" <b>Appended text</b>.");

    });

    $("#btn2").click(function(){

        $("ol").append("<li>Appended item</li>");

    });

});

  </script>

</head>

<body>


  <p>This is a paragraph....</p>

  <p>This is another paragraph.....</p>

  <ol>

    <li> item A</li>

    <li> item B</li>

    <li> item C</li>

  </ol>

  <button id="btn1">Click here to Append text</button>

  <button id="btn2">Click here to Append list item</button>

</body>

</html>