Is there any way I can trap html select events, and prevent the html select dropdown to open? (Disabling html select is ruled out since the events will be disabled too.)
I doubt this will actually prevent it from opening, but it will ensure that the DropDown will always maintain the same value:
<select name="theselect" onchange="this.selectedIndex = 1;">
<option value="Red">Red</option>
<option value="Green" selected="selected">Green</option>
<option value="Blue">Blue</option>
</select>
This doesn't disable the "dropdown to open", but if you don't want anything selectable, a trick I used was to make <optgroup>
instead of option
. However, I'm confused why you would want to disable the dropdown, but disabling it is not option...
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