Is there a way to make a $(selector).click(function) run before, or preceed, an inline onClick="function"?
Also, if possible, I would like to stop the inline function from running entirely (by using preventDefault() inside the $(selector).click()).
Here’s a fiddle to illustrate the precedence: http://jsfiddle.net/yUZWR/1/
Assuming you meant the anchor ID to be called
linkand not#link, this is how to reverse the function execution order…I’m certain there’s a better way of doing this i.e., not using
eval. To prevent the inline function running altogether, just omit the second call toclick.