-1

I am writing an XHTML form, and I need a little help. I have used a button to allow the user to reset. When the alert triggers, I want it to give them the option to proceed or cancel, but all I am getting is an 'Ok' which will run the reset anyway. Any help is greatly appreciated, as I am new to HTML. Thanks.

Edit: I am now using confirm, but either button click in the confirm box are proceeding with the reset of the form anyway.

Danny Wilson
  • 331
  • 2
  • 11
  • Okay thanks, I have changed it, but if I enter information into the form, click reset and then click cancel on the confirm box, it resets the form anyway... Any ideas? The button is type 'reset' – Danny Wilson Mar 06 '15 at 18:14

1 Answers1

1

You are looking for confirm, not alert.

<form onsubmit="return confirm('Really send form?');">
    ...
</form>

I used submit event on form instead of onclick event on button, because you can send form using enter too, not just by button.

pavel
  • 26,538
  • 10
  • 45
  • 61