You're adding the event handler to the <select>
element.
Therefore, $(this)
will be the dropdown itself, not the selected <option>
.
You need to find the selected <option>
, like this:
var option = $('option:selected', this).attr('mytag');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…