JQuery Insert Html with After

 

In this example we are going to choose in paragraph and Textbox where I am dynamically inserting new paragraph and text box  in HTML page using after() method

 
 
 
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> <script> function Paragraph(){ $("p:first").after("<p style=background-color:red>APPWRK IT Solutions is a complete Web Solutions Company offering customer-oriented web design services and more importantly, deliver them effectively.</p>"); } function Textbox(){ $("input:text:last").after("<br><input type='text' style='height: 40px; width:250px; border-radius: 10px' name='text2'>"); } </script> </head> <body> <p style="font-size: 30px; color:mediumvioletred">Appwrk Information</p> <input type="button" style="height:60px; width:250px; border-radius:10px" onclick="Paragraph()" value="let's add Appwrk Information"> <br><br> <input type="text" style="height: 40px; width:250px; border-radius: 10px" name="text1"> <br><br> <input type="button" style="height: 60px; width:250px; border-radius: 10px" onclick="Textbox()" value="let's add Dev Tool(Textbox)"> </body> </html>
Output