Is there any way to determine if an HTML select is currently open?
I have a page that is doing a co开发者_运维百科ntinuous ajax refresh, and I don't want to do this refresh if the user is currently making a selection in a dropdown. Is there any way to check if the user has the dropdown opened, and then stop the update?
Thanks!
The only way I can think of, is to use a flag (a variable) that will change value when the user clicks the SELECT (and knowing that when the page is first loaded, the SELECT is closed) this should make it easy to know if the SELECT is open or not.
Try binding "click" to the body whenever the select is clicked. That event will fire whenever the user clicks off the select.
精彩评论