Make <a> run Javascript code when clicking - Javascript jQuery

Javascript examples for jQuery:Link

Description

Make <a> run Javascript code when clicking

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
 </head> /* w ww .j  a v a2 s  .  co m*/
 <body> 
  <a href="javascript:;" onclick="if(true){console.log('a');}">aaasa</a>  
 </body>
</html>

Related Tutorials