javascript - a href onclick event is not working if there a rel attribute defined on it -
i have onclick event href , if define rel function not getting called
<a href="http://somewebsite" onclick="javascript:somefunction('somevalue');" name="top" rel="somevalue">testing </a>
if remove rel
property onclick working fine.
what's that?
i'm not sure answer, more of debugging diagnostic. plus, getting bit long use in comments section.
there no js errors me in either chrome 7 or ff 3.6.8
there no apparent unclosed quotes in anchor tag
while rel tag not directly supported modern browser (but rather used search spiders), consensus shouldn't affect events. in fact, per user comments, such @james kovaks, works fine in his tests.
from chrome js console, function trackforga visible, , executable without error.
attaching event jquery, , clicking, fires event expected. tells click event in fact being fired browser.
code:
$('#countrytabs li:first').click(trackforga); // click overview tab
suggested next steps:
- try other event types, see if affected - such onmouseover.
- begin removing javascript not related particular event. specifically, js want remain trackforga function , onclick js. remove externally loaded js, such jquery (you can presumably on local test/dev box)
- if problem persists, remove trackforga , instead alert() onclick event.
- if problem persists, run site through html validator (http://validator.w3.org/)
- if problem persists after fixing validation problems, begin removing unrelated html tags , content. systematically remove items until click firing expected identify potential culprit.
Comments
Post a Comment