I have a table of rows. In one of the columns, some rows have a span with static text, some rows have a select with values to choose from. All elements in that one column have the same name attribute. In my form submit, I iterate thru the rows and want to get the values for all columns. I would prefer to have one jQuery selector statement to get the value from that element (span or select with name attribute of "materialValue"). How would I do that with jQuery? Here follows the html snippet.
<table>
<tr><td>
<span id="materialValue1" name="materialValue>ONE</span>
</td></tr>
<tr><td>
<span id="materialValue2" name="materialValue>TWO</span>
</td></tr>
<tr><td>
<select id="materialValue3" name="materialValue>
<option>ONE</option>
<option>TWO</option>
<option>THREE</option>
</select>
</td></tr>
<tr><td>
<select id="materialValue4" name="materialValue>
<option>ONE</option>
<option>TWO</option>
<option>THREE</option>
</select>
</td></tr>
</table>
Edit: I'm used to specifying the element type then square brackets with the attribute name/value. I'm not sure how to specify the jquery selector without the element type name. e.g. $('span[name="materialValue"]', this). Is it legal to specify $('[name="materialValue"]', this)? looks weird to me.
name=materialValuenameattribute is invalid markup. either usename = whatever[]nameon multiple elements be invalid? Thats how check boxes and radio buttons work in the first place.spandivselectwith same name. 'checkbox' 'radio` have diffrent property