Set value of content to content.replace - Javascript String Operation

Javascript examples for String Operation:String Replace

Description

Set value of content to content.replace

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
function process() {/*w  ww . j  a v a  2  s .  co m*/
    var content = document.getElementById('content').value;
    content = content.replace(/(<tt>)(.*?)(<\/tt>)/g, '$2')
    content = content.replace(/-/g,'');
    document.getElementById('content').value = content;
}

      </script> 
   </head> 
   <body> 
      <textarea id="content" cols="48" rows="8"></textarea>
      <br> 
      <input type="button" value="Process" onclick="process()">  
   </body>
</html>

Related Tutorials