Suppose I have a select tag and some option tag in it,then I want add mouseover event on option tag,I have tried some ways,but all doesn't work chrome:
method 1:
function showtrail(){
console.log("mouseover");
}
var el=document.querySelectorAll('#select option');
for(var i=0;i<el.length;i++){
el[i].addEventListener("mouseover",showtrail,false);
}
method 2:
<option onmouseover="showtrail()" value="d">d</option>
method 3:
off course I tried jquery hover method
all this doesn't work in chrome ,only work in firefox
how can I solve this problem ?add hover or mouseover event on option tag ,and could work fine in chrome
No comments:
Post a Comment