I have a div with an id=”my_div”. How can I find a <select> by name (i.e. name="my_select") assuming that the <select> can be at any level underneath the div? I.e. it can be a child, grandchild etc. Ultimately I need to get the value of the selected option.
I have a div with an id=my_div. How can I find a <select> by
Share
This will search through all descendants of
#my_divfor<select>elements where thenameattribute equalsmy_select.To get the value of the currently selected option, use
.val().