jQuery appendTo() Method

Last Updated:

jQuery appendTo() Method

The jQuery appendTo() method inserts specified content at the end of the selected elements.


HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <h1>jQuery appendTo() Method</h1> <p>My name is Jade </p> <button>Click me more than once</button> <script> $(document).ready(function(){ $("button").click(function(){ $("<strong> and I like programming</strong>").appendTo("p"); }); }); </script> </body> </html>



Parameter Values

Value Type Explanation
htmlString Required Specifies a html string to be appended.
selector Required Specifies the selector to which the html string should be appended.

Browser Support

Browsergoogle chromesafarifirefoxinternet Exploreredgeoperagoogle chromesafarifirefoxedgeoperaandroid webviewsamsung internet

Share this Page

Meet the Author