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...). Why and how can I change that? (works in FF and in Chrome on Windows)
$("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/
Note: click on the text, not on the arrow
I have finally fixed it by replacing click
with mouseup
$("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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.