Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2008
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts

    button + jQuery + return false + function

    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?
    Last edited by ricmetal; 07-03-2012 at 06:46 AM.

  • #2
    Regular Coder Nile's Avatar
    Join Date
    Jun 2008
    Posts
    280
    Thanks
    2
    Thanked 46 Times in 46 Posts

  • #3
    New Coder
    Join Date
    Nov 2008
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts
    yep, tried preventDefault.

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

    EDIT:

    the error was human.
    resolved
    regards
    Last edited by ricmetal; 07-03-2012 at 06:44 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •