我需要通过单击按钮从下面的 optGroup selectList 中获取选定的文本和值。那么像什么?
$("#addButton").click(function () {
var selected = ???
});
<select name="list">
<optgroup label="mammals">
<option>dog</option>
<option>cat</option>
<option>rabbit</option>
<option>horse</option>
</optgroup>
<optgroup label="reptiles">
<option>iguana</option>
<option>snake</option>
</optgroup>
</select>