简体   繁体   English

JQuery select 上的单击事件在 Linux 上的镀铬中不起作用(ZAEA2342888282F0406A 上的镀铬有效)

[英]JQuery click event on select element click does not work in chrome on Linux (chrome on Windows works)

When I click on the select element in chrome, the event does not get triggered on first click (but after that, ie on second, third...).当我单击 chrome 中的 select 元素时,该事件不会在第一次单击时触发(但在那之后,即第二次、第三次......)。 Why and how can I change that?为什么以及如何改变它? (works in FF and in Chrome on Windows) (适用于 FF 和 Windows 上的 Chrome)

 $("select").click(function() { console.log("click"); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <select> <option>a</option> </select>

https://jsfiddle.net/pv2eajux/ https://jsfiddle.net/pv2eajux/


Note: click on the text, not on the arrow注意:点击文字,而不是箭头

I have finally fixed it by replacing click with mouseup我终于通过用mouseup替换click来修复它

 $("select").mouseup(function() { console.log("click"); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <select> <option>a</option> </select>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM