Search Results

Search found 1 results on 1 pages for 'm woodard'.

Page 1/1 | 1 

  • Append an onClick event to an anchor tag using jquery?

    - by M.Woodard
    I am trying to add an onClick event to an anchor tag ... Previously i had ... <a href="somlink.html" onClick="pageTracker._link(this.href); return false;"> But i am trying to avoid the inline onClick event because it interferes with another script.. So using jQuery i am trying the following code ... <script> $(document).ready(function() { $('a#tracked').attr('onClick').click(function() {window.onbeforeunload = null; pageTracker._link(this.href); return false; }); }); </script> with the html like so <a id="tracked" href="something.html"> So my question is should this be working, and if not what would be the best solution?

    Read the article

1