What is wrong with my jquery code for cancelling a href? [closed]
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question 开发者_StackOverflow中文版http://jsfiddle.net/W59sw/3/
When someone clicks on the button, I want to prevent the page from redirecting, and do some custom stuff. What am I doing.
You forgot to include jQuery in your jsFiddle. There is nothing wrong with your code.
You loaded MooTools and not jQuery on the jsFiddle
You need to select jQuery on the left, not MooTools.
Your code works fine, but your jsFiddle is not loading jQuery. Also note that in this case you probably don't need to preventDefault() and should just use return: false;
精彩评论