I want to trigger the submit event of the form in which the current element is located. Sometimes I know what works:
this.form.submit();
I am wondering if there is a better solution, possibly with jQuery, since I'm not sure if the 100% method works in every browser.
Edit:
The situation that I have is as follows:
<form method="get"> <p><label>Field Label <select onchange="this.form.submit();"> <option value="blah">Blah</option> .... </select></label> </p> </form>
I want to be able to submit the form when changing the <select> .
What I'm looking for is a solution that works in any field in any form, without knowing the identifier or name in the form. $('form:first') and $('form') will not work because the form may be the third on the page. In addition, I already use jQuery on the site, so using a bit of jQuery is not a big problem.
So, is there a way to get jQuery the form that input / select / textarea is in?
javascript jquery submit forms
Darryl Hein Jan 6 '09 at 20:49 2009-01-06 20:49
source share