i have something like this: http://jsfiddle.net/PTcw8/4/
<div id="container">
<a href="#" onclick="javascript:alert('inline'); return false;"> show me </a>
<br />
<input type="button" value="click to change the links onclick event" onclick="javascript:changeOnClick(); return false;" />
</div>
function changeOnClick() {
$("#container a").unbind('click');
$("#container a").on('click', function() {
alert("changed on the fly");
})
}
the link has an inline onclick event, i cant unbind it and bind a new handler, they just stack for some reason.
isn’t it possible to unbind inline handlers?
You can only
.unbind()an event handler if you have previously attached it with.bind():For inline event handlers, either use:
or
DEMO.