Strip html with jQuery inside a function - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Strip html with jQuery inside a function

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials