title: replace all </script> tags with <\/script> in javascript or jquery
body: <p>I need to replace all these tags <code>&lt;/script&gt;</code> with these tags <code>&lt;/script&gt;</code></p>
  
  <p>Before: -> <code>&lt;script&gt;..code..&lt;/script&gt; &lt;script&gt;..code..&lt;/script&gt;</code></p>
  
  <p>After:  ---> <code>&lt;script&gt;..code..&lt;\/script&gt; &lt;script&gt;..code..&lt;\/script&gt;</code></p>
  
  <p><br>
  But this does not work:</p>
  
  <pre><code>function myReplace(){
      var X = document.getElementById("demo").innerText;
      var Y = X.replace(/&lt;/script&gt;/ig, '&lt;\/script&gt;');
      document.getElementById("demo").innerText = Y;
  }
  </code></pre>
  
  <p><b><a href="http://jsfiddle.net/wG3LG/3/" rel="nofollow noreferrer">DEMO</a></b></p>
  
  <p>Here's a related <b><a href="https://stackoverflow.com/questions/24988672/document-write-replace-script-tags-with-script">post</a></b> for a better understanding</p>