I have a form:
<form id="myForm">
<select name="mySelect">
<option value="250">250</option>
<option value="500">500</option>
</select>
<input id="submit-123" type="submit" />
</form>
And I need to get the value of the submit in a clever kind of way. There are multiple forms on the page, so I need to get the one related to the submit button that has been clicked.
var form = $('#submit-123').closest('form');
But I can’t work out how to get the value of the select, without referencing the index (it needs to be more robust than that).
The closest I’ve gotten is using: form.children() but I still can’t work out how to accurately target the select.
I’m a JS newbie and any help would be greatly appreciated.
This should work for you,