jquery - How to add onClick event to an a tag with class -
here's have on page
<a class="download-link" href="http://www.test.com/pages-">pages 1</a> below result want achieve jquery.
<a class="download-link" href="http://www.test.com/pages-1.asp" onclick="_sz.push(['event', 'pdf', 'download', ('report') ])">pages 1</a> jquery
<script type="text/javascript">/ $('.download-link').each(function(){ this.href += '-1.asp'; this.attr('onclick', '_sz.push(['event', 'pdf', 'download-request', ('report') ])'); }) </script>
try one.
$('.download-link').bind('click', function (event) { _sz.push(['event', 'pdf', 'download', ('report')]) }); i hope. helps you.
Comments
Post a Comment