Javascript examples for jQuery Method and Property:html
Strip html with jQuery inside a function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){/*w ww . j a va2 s .com*/ function removeHtml(input){ return $("<span>"+input+"</span>").text(); } console.log(removeHtml("I was a string with <h1>HTML!</h1>")); }); </script> </head> <body> </body> </html>