Edit a tag with jQuery - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:attr

Description

Edit a tag with jQuery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script> 
 </head> /*w w  w.  j  ava2s. co  m*/
 <body> 
  <ul> 
   <li>...</li> 
   <li>...</li> 
   <li> <a href="http://your url">Go</a> </li> 
  </ul> 
  <script type="text/javascript">
$('ul li:last>a').attr('onclick',"ga('send', 'event', { eventCategory: 'Menu-Button', eventAction: 'Click'});");

      </script>  
 </body>
</html>

Related Tutorials