title: Select all element with same tag name using javascript and highlight content partially
body: <p>I made a code that should highlight searched string but it is not working.<br>
  Here is the code:  </p>
  
  <pre><code>&lt;body&gt;
  
    &lt;div&gt;div is here&lt;/div&gt;
     &lt;div id="divid"&gt;
  
      &lt;div&gt;this is a div 1&lt;/div&gt;
      &lt;div&gt; this is a div 2&lt;/div&gt;
      &lt;div&gt; this is a div3&lt;/div&gt;
  
    &lt;/div&gt;
  
    &lt;div&gt; another div is here&lt;/div&gt;
    &lt;/body&gt;  
  </code></pre>
  
  <p>Here is a javascript code.  </p>
  
  <pre><code>  function checkit(){
  
  var hlWord = "div";
          var nregex = new RegExp(hlWord,"gi");
          var div = document.getElementById("divid").getElementsByTagName('div');
  
          for(var i=0; i &lt;= div.length; i++){
  
              var div1 = div[i].innerHTML;
  
              var rword = div1.replace(nregex,"&lt;b&gt;"+hlWord+"&lt;/b&gt;");
              div1.innerHTML = rword;
  
          }
  
  
    }  
  </code></pre>