Friday, 15 February 2013

jquery - Form with multiple buttons - all are submitting the form -



jquery - Form with multiple buttons - all are submitting the form -

my form, 'file-upload' has submit button:

<button id="btn-save" type="submit">save</button>

i utilize so:

$('#file-upload').submit(this.save.bind(this));

the problem is, form has other buttons in it:

<button class="btn-delete">&times;</button>

and these appear running this.save method.

how can prevent this?

this know behavior, <button> s within form tag deed submit button, either need prevent default behavior event.preventdefault() or alter buttons <input type='button'>

jquery

No comments:

Post a Comment