I am trying to selectively hide options in a dropdown using the 'hidden' attribute. Please see jsfiddle , in which I hide the “quietest” option.
$('#quietest').prop('hidden', 'hidden');
When you click the arrows in the drop-down list, the option “quietest” is successfully hidden (only “fastest” and “balanced” are displayed), however, the user can still choose the “quietest” option using the keyboard. Is this the expected behavior for a "hidden" attribute? How to hide it so that it is no longer chosen? It is also necessary to easily display this option (therefore it is preferable not to delete the option).
source
share