View Full Version : Resolved button + jQuery + return false + function

Jul 3rd, 2012, 01:47 AM
hi guys

i've attached an on click method to a html submit button via jQuery. this button runs a function and then a return false to avoid the button's default action.

thing is, attaching return false, via jQuery, after the function call does not avoid the button's default action, but if i omit the function call, returning false does indeed avoid the buttun's default action.

the same goes for adding return false to the button's html onclick attribute, while running the function, on click, set via jQuery. the button's default action is halted.

anyone explain this behaviour or point me in direction to some reading material?

Jul 3rd, 2012, 02:00 AM
Have you tried http://api.jquery.com/event.preventDefault/

Jul 3rd, 2012, 02:24 AM
yep, tried preventDefault.

worth noting that the function has no more than two var declarations, in order to keep debugging simple..


the error was human.