I want a <select>
element to respond differently to an enter key stroke depending on whether the dropdown is currently open or closed.
Is it possible to detect when a <select>
element has the drop down list has opened or closed using JavaScript? Something like this, perhaps:
<select name="selExample" onChoicesOpen="console.log('opened');" onChoicesClosed="console.log('closed');">
Or is there a way to determine if the dropdown is open using Javascript. Maybe something like:
$("#selExample").isDropDownOpen()
I'm OK if there is a solution that only works in Chrome (don't need IE support). I'm OK if the solution requires a library such as jQuery or something else.