jquery.AreYouSure icon indicating copy to clipboard operation
jquery.AreYouSure copied to clipboard

Toggle button tag rather than submit input breaks change event

Open rdejuana opened this issue 10 years ago • 2 comments

If i use a button instead of an submit input, the change event will stop working.

I use the code below, which is very similar to your example.

change = () ->
    $form = $(this)
    $button = $form.find('button')
    if $form.hasClass('dirty')
      $button.removeAttr('disabled');
    else
      $button.attr('disabled', 'disabled');


$('form').areYouSure({change: change})

My form is pretty standard form with some radio buttons. If i toggle the radio buttons and turn off the removeAttr line, it will work fine. When I reenable it, it will work the first time and never fire again.

Any idea what is wrong?

rdejuana avatar Feb 09 '15 22:02 rdejuana

Is this related to the pull request #73 ? Did this change fix the issue?

codedance avatar Feb 11 '15 22:02 codedance

I think it fixed it. I have only tested it in chrome so far. I'm not too sure how your code works, but the exclusions in your fields selector seemed to imply the fix to my issue.

I know the some browsers (cough...ie..cough) had issues before with the button tag, but its been a while since i have seen them.

rdejuana avatar Feb 12 '15 15:02 rdejuana