私は現在使用addEventListener
していselect
ます:
<select>
<option value="Apple">Mac</option>
<option value="Microsoft">Windows</option>
</select>
document.querySelector("select").addEventListener("change",function(ev){
//do something here...
}, false);
しかし、から元の要素を取得する方法がわかりませんevent
。
PS:私はこれをしたくありません:
<select onchange="func(event,this)">
これはHTMLを台無しにするだけです...