I have a form like this:
<form id='formi开发者_如何学Cd'>
<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.
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
};
$("#resetbutton").click(function(){
$("#formid").submit()
});
this will set the click event on the button and submit the form when it's executed.
(function () {
var $formObject = $("#formid").eq(0);
$("#resetbutton", $formObject.get(0)).click(function (){
$formObject.submit();
});
})();
精彩评论