title: Replace a text using JQuery
body: <p>Hi I am trying to replace a text using JQuery. but it's replacing with duplicate text.</p>
  
  <p>I have tried below code:</p>
  
  <p><strong>HTML Code</strong></p>
  
  <pre><code>&lt;a class="text_div"&gt;
      This div contains some text.
  &lt;/a&gt;
  &lt;br&gt;
  &lt;a class="text_div"&gt;
      This div contains some text.
  &lt;/a&gt;
  &lt;br&gt;
  &lt;a class="text_div"&gt;
      This div contains some text.
  &lt;/a&gt;
  </code></pre>
  
  <p><strong>jQuery Code</strong></p>
  
  <pre><code>$(document).ready(function(){
      var text = $('[class="text_div"]').text();
    var new_text = text.replace("contains", "hello everyone");  
    $('[class="text_div"]').text(new_text);
  });
  </code></pre>
  
  <p><strong>Resulted OUT Put</strong></p>
  
  <pre><code>This div hello everyone some text. This div contains some text. This div contains some text. 
  This div hello everyone some text. This div contains some text. This div contains some text. 
  This div hello everyone some text. This div contains some text. This div contains some text.
  </code></pre>
  
  <p><strong>Expecting Out Put</strong></p>
  
  <pre><code>This div hello everyone some text.
  This div hello everyone some text. 
  This div hello everyone some text.
  </code></pre>