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

Javascript examples for String Operation:String Replace


Set value of content to content.replace

Demo Code

ResultView the demo in separate window

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

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

Related Tutorials