开发者

Is there any way to determine if an HTML select is currently open?

开发者 https://www.devze.com 2022-12-10 14:20 出处:网络
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 us

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号