jQuery <div> create div element
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Create a DIV Element Dynamically Using jQuery</title> <style> .container{//from ww w . j a v a 2 s. c o m padding: 20px; background: #f2f2f2; border: 5px solid #aaa; } .content{ padding: 10px; border: 3px solid orange; } </style> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ // Creating a div element at the end $(".container").append('<div class="content">Appended DIV</div>'); // Creating a div element at the start $(".container").prepend('<div class="content">Prepended DIV</div>'); }); }); </script> </head> <body> <div class="container"> <h1>This is a heading</h1> <p>This is a paragraph.</p> <p><button type="button">Insert DIV</button></p> </div> </body> </html>