Javascript examples for jQuery:Text
Adding text to an existing text element in javascript via DOM
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#btn1").click(function(){ $("p").append(" <b>Appended text</b>."); });//from w w w .j ava 2s .co m }); </script> </head> <body> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button id="btn1">Append text</button> </body> </html>