Hide outline focus on link when click - Javascript DOM Event

Javascript examples for DOM Event:onclick

Description

Hide outline focus on link when click

Demo Code

ResultView the demo in separate window

<html lang="en">
   <head> 
      <style>

a:focus, a:active {
   outline:0;
}
a.tabbed {//from ww w  .j av a 2 s . c  om
   outline:1px solid red;
}


      </style> 
   </head> 
   <body translate="no">   
      <a href="#">link 1</a> 
      <a href="#">link 2</a> 
      <a href="#">link 3</a>   
      <script>
      document.addEventListener('keyup', function (e) {
  var code = e.keyCode ? e.keyCode : e.which;
  var el = document.activeElement;
  console.log('key event');
  if (code == 9 && el.tagName == 'A') {
     el.className = "tabbed";
     console.log("tabbed");
  }
}, true);
    
      </script>  
   </body>
</html>

Related Tutorials