JavaScript Programming JavaScript > Code Examples Add and remove text paragraph Add and remove text paragraph <html> <head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <style type="text/css"> a.test { font-weight: bold; color:red;} </style> <script type="text/javascript"> $(document).ready(function(){ $("input.buttonA").click(function(){$("div.contentToChange").find("p").not(".alert").append("<strong> Appended</strong>")}); $("input.buttonB").click(function(){$("strong").remove()}); }); </script> </head> <body> <input type="button" value="Add" class="buttonA" /> <input type="button" value="Remove" class="buttonB" /> <div style="background:#eee;" class="contentToChange"> <h2>Header 2</h2> <p class="firstparagraph"> Love is hard to get into, but harder to get out of. <br /> <br /> <b>Sean Bawden</b></p> <p class="secondparagraph"> A man falls in love through his eyes, <br /> a woman through her ears. <br /> <br /> <b>Woodrow Wyatt</b> </p> <p class="thirdparagraph"> he who cries the loudest shows the most pain he who keeps it all inside <br /> dies in vain (from 'when a thought becomes u') <br /> <br /> <b>Blake Baxter</b> </p> <p class="fourthparagraph"> A happy marriage has in it all the pleasures of friendships, <br /> all the enjoyment of sense and reason - and indeed all the sweets of life. <br /> <br /> <b>Joseph Addison (The Spectator Magazine)</b> </p> <p class="fifthparagraph"> I can live without money, but I cannot live without love. <br /> <br /> <b>Judy Garland</b> </p> <p class="sixthparagraph"> True love never dies for it is lust that fades away. <br /> Love bonds for a lifetime but lust just pushes away. <br /> <br /> <b>Alicia Barnhart</b> </p> </div> </body> </html>