Reputation: 8517
Saying that I have this HTML form:
<form id="form">
<input id="input_el" type="text">
<input id="submit_el" type="submit">
</form>
I want to get the form element starting from one of its input elements, so I could write:
<script type="text/javascript">
$('#input_el').form().validate();
$('#submit_el').form().submit();
</script>
That is, $('#input_el').form()
should return $('#form')
. Is that possible?
Thanks!
Upvotes: 0
Views: 383
Reputation: 1999
$('#input_el').parent('form')
or
$('#input_el').parent()
Upvotes: 0