title: remove href from link using JavaScript
body: <p>I am using this code to remove the href links from my page. It works great except I do not want to target all the links. Instead, I want to target all of the links within a div, like disable all the links of a particular div with an id "test2".</p>
  
  <pre><code>var all_links = document.getElementsByTagName("a");
  
  for(var i=0; i&lt;all_links.length; i++){
      all_links[i].removeAttribute("href");
  }
  </code></pre>