ofko ofko - 1 year ago 117
jQuery Question

On select change, get data attribute value

The following code returns 'undefined'...


<option data-id="1">one</option>
<option data-id="2">two</option>
<option data-id="3">three</option>

Answer Source

You need to find the selected option:




although the first method is preferred.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download