Javascript examples for jQuery Method and Property:append
Inserting into newly created elements
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.4.2.js"></script> <script type="text/javascript"> $(window).load(function(){/* w ww. j ava 2 s.c om*/ var elementToAdd = $('<h3>').html('header'); var p = $('<p>').html('hello world'); $('div#content').append(elementToAdd); elementToAdd.after(p); }); </script> </head> <body> <div id="content"> </div> </body> </html>