title: replace the string "Microsoft" with "W3Schools Test$'"
body: <p>I would like to replace the string "Microsoft" with "W3Schools Test$".</p>
  
  <p>Please note that there is single quotes after the dollar sign.</p>
  
  <p>It is not working with my below code. You can see demo-one is working perfectly, but in case of demo-two its not working well.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function myFunction() {
      var str_one = document.getElementById("demo-one").innerHTML; 
      var res_one = str_one.replace("Microsoft", "W3Schools Test$");
      document.getElementById("demo-one").innerHTML = res_one;
      
      var str_two = document.getElementById("demo-two").innerHTML; 
      var res_two = str_two.replace("Microsoft", "W3Schools Test$'");
      document.getElementById("demo-two").innerHTML = res_two;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p&gt;Click the button to replace "Microsoft" with "W3Schools" in the paragraph below:&lt;/p&gt;
  
  &lt;p id="demo-one"&gt;Visit Microsoft!&lt;/p&gt;
  &lt;p id="demo-two"&gt;Visit Microsoft!&lt;/p&gt;
  
  &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is the output of the above code.</p>
  
  <p><code>Click the button to replace "Microsoft" with "W3Schools" in the paragraph below:
  Visit W3Schools Test$!
  Visit W3Schools Test!!</code></p>
  
  <p>Third line should show as <code>Visit W3Schools Test$'</code> but it showing as <code>Visit W3Schools Test!!</code></p>
  
  <p>Please help me to get out from this problem.</p>
  
  <p>Thanks in advance.</p>