// Getting a new element on to the page. var myNewElement = $( "<p>New element</p>" ); myNewElement.appendTo( "#content" ); myNewElement.insertAfter( "ul:last" ); // This will remove the p from #content! $( "ul" ).last().after( myNewElement.clone() ); // Clone the p so now we have two.
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter