Javascript examples for jQuery Method and Property:attr
Edit a tag with jQuery
<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>