I need some help getting and "onclick" event onto some links in a couple drupal pages.
I've got 2 pages, each with a text entry field set to "full HTML", within which I've added my a tags. the links work great in this format, however when I try to add my onclick event (which contains jquery info for analytics tracking), the only thing I see when I inspect element is the text "onclick" and nothing after it. Not even the " =" ", which would suggest a script error.
When that didn't work I added a class to the A tags and tried to use jquery to append the onclick attribute with these jquery functions: setAttribute attr click
While it sounds simple none of what I've tried has worked (I had used both setAttribute and click successfully on other links), so now I'm looking for a new method. the module Menu attributes doesn't work since it doesn't deal with "onclick" and my links are not menu items, they are just links in text.
I'm using Drupal 6.19 and jquery update.
If anyone has advice or suggestions, please let me know,
Thanks Steph
setAttribute()
function, you're probably thinking of the basic javascript function of that name. Since you just want to bind to an event you don't need to inline an attribute, just use$('.selector').click(function() { doSomething(); });