Javascript examples for jQuery:Text
print html as plain text
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("#elem").text('This <b>contains</b> html'); });// w w w . j av a2s .co m }); </script> </head> <body> <button>Click ME!!</button> <p id="elem">This is a paragraph.</p> </body> </html>