I have a page that is doing a continuous 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!
Use the tagName property to check if an element is a select dropdown, e.g. if (select. tagName === 'SELECT') {} .
select2:open is fired whenever the dropdown is opened. select2:opening is fired before this and can be prevented. select2:close is fired whenever the dropdown is closed. select2:closing is fired before this and can be prevented.
selectedIndex is a long that reflects the index of the first or last selected <option> element, depending on the value of multiple . The value -1 indicates that no element is selected.
Definition and Usage. The <select> element is used to create a drop-down list. The <select> element is most often used in a form, to collect user input. The name attribute is needed to reference the form data after the form is submitted (if you omit the name attribute, no data from the drop-down list will be submitted) ...
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With