Reputation: 18560
I have a form like this:
<form id='formid'>
<input type='text' name='textname'>
<input type='button' id='resetbutton'>
</form>
Now I want to jquery code which submit a form with id=formid
when a button(id='resetbutton' in id=formid form)
is clicked. And I want it to also run in IE7.
Thanks for your help.
Upvotes: 1
Views: 948
Reputation: 1322
You should use the native reset button:
<input type="reset" value=" Reset ">
and extend it with jquery:
$('#formid').children('input[type="reset"]').click(function() {
//do what you want
};
Upvotes: 2
Reputation: 10598
(function () {
var $formObject = $("#formid").eq(0);
$("#resetbutton", $formObject.get(0)).click(function (){
$formObject.submit();
});
})();
Upvotes: 0
Reputation: 4992
$("#resetbutton").click(function(){
$("#formid").submit()
});
this will set the click event on the button and submit the form when it's executed.
Upvotes: 1