JavaScript OnClick Handler Not Invoking

Posted by potatolicious on Stack Overflow See other posts from Stack Overflow or by potatolicious
Published on 2010-05-10T22:59:58Z Indexed on 2010/05/10 23:04 UTC
Read the original article Hit count: 271

Filed under:
|
|

I'm calling a javascript function in an inline onclick like so:

<a href="#" onclick="removeAttribute('foo', 'bar');">Some Link</a>

When I click on the link, though, nothing happens. I have other links (to other functions) tied to onclicks that work fine elsewhere on the same page. All links to this "removeAttribute" function fail.

There are no errors in Firebug, and the onclick event handler is being invoked - but stepping into the removeAttribute function ends up, for some reason, somewhere in jQuery.js. At no point does removeAttribute ever get called.

If I do:

javascript:removeAttribute('foo', 'bar');

in Firefox's address bar. The function is called successfully.

Anyone seen this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery