Sounds interesting MrDean. I've had similar experience trying to unbind events that were previously bound by something else and it can be a bit of a noodle-scratcher. Without seeing an example of what your elements look like (as HTML) it's difficult to know how these events are bound.
If they are bound by simply populating the onclick
attribute of each element, this one is quite easy to undo.
$('.myElement').attr('onclick', ''); //Empty out the onclick attribute
$('.myElement').bind('click', function(){ ... }); //Bind your own function to the click event
You'll find it's a much better idea to bind your function using the DOM rather than manipulating attributes of individual elements. It's much more flexible and there's a lot more you can do with it.
Now, if your original functions are bound using the DOM method rather than manipulating the onclick
attribute things get a little trickier. The first thing you could try is to go:
$('.myElement').unbind();
which will make jQuery unbind all events associated with a given element. Where this gets tricky is figuring out when to call unbind()
. If you do it on ready
and the other library executes its ready
function after yours, then you've achieved nothing because the events haven't been bound yet.
Give this a try and let me know how you go. Failing that, please upload the HTML of the page you are trying to manipulate and I'll take a look.
Hope this helps!
Cheers
Iain