Why doesn't the function work?
-
document.getElementsByTagName("option").onmousedown = function(e) { if(e.button === 2) { alert(2); } };
JavaScript Anonymous, Apr 11, 2019 -
getElement s ByTagName (plural)
You get an array, not a single item.
Then it's like this:
document.getElementsByTagName("option")[0].onmousedown =
Anonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!