How do I make alert() return either 123, 456 or the nth group key?
I wanna retrieve the index key is to do some chain operations on the corresponding option values.
Note: The index keys could just as well be alphanumeric.
HTML:
<select name="option[group][123]">
<option>a</option>
<option>b</option>
</select>
<select name="option[value][123]">
<option>1</option>
<option>2</option>
</select>
<select name="option[group][456]">
<option>a</option>
<option>b</option>
</select>
<select name="option[value][456]">
<option>1</option>
<option>2</option>
</select>
Script:
$("select[name^='option[group]']").change(function(){
alert('Index:' + $(this).fieldsetIndexKeyIdentifier());
// Do something with option values of group
});
.index()?