I recently discovered an issue with preventing default behavior or returning false using jQuery .mousedown() . Below are 2 test cases I’ve made; the first using click and the second mousedown. The first test executes properly…returning false and removing the #hash from the url. The second using mousedown fails, and the hash remains in the url.
Any ideas why click works, but mousedown doesn’t?
Edit: I’m thinking this happens because a click event is firing immediately after the mousedown. So essentially both mousedown AND click will fire when using mousedown. To fix this, you must also return false for click. Am I on the right track?
Mousedown and click have different functions. Try and highlight the test in both examples. Also, you should be using preventDefault() and not return false, since return false also does stopPropagation()` and that probably isn’t your intention.