title: Javascript- do somthing onclick any <a> tag except href="#" and href="<javascript>" tags
body: <p>How to do something <code>onclick</code> any <code>&lt;a&gt;</code> tag except <code>href="#"</code> and <code>href="javascript"</code> tags</p>
  
  <p>I have a script but it also working on <code>href="#"</code> like tags. I want to exclude <code>href="#"</code> and <code>href="javascript"</code> tags.</p>
  
  <p>this is my current script</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>    window.addEventListener('load', function (){
             if (!document.getElementsByTagName) return;
                  var anchors = document.getElementsByTagName("a");
                  for (var i=0; i&lt;anchors.length; i++){
                       var anchor = anchors[i];
                       if(anchor.getAttribute("href"))
                            anchor.target = "_blank";
                  }  
  
      function tabunder() {
        window.location = 'https://example.com' ;
       }  
         
         
      for (var i=0; i&lt;anchors.length; i++){
       anchors[i].onclick = tabunder;
      }
  
  
      });</code></pre>
  </div>
  </div>
  </p>