I’m a bit confused, why I can use .remove() but not .hide() on an option.
Does someone know why?
The HTML Code:
<select>
<option value="choose">---</option>
<option value="foo">foo</option>
<option value="bar">bar</option>
</select>
And the Javascript Code:
$('select').focus(function() {
$('option[value="choose"]').hide();
//$('option[value="choose"]').remove();
});
Here’s the JSFiddle: http://jsfiddle.net/PzaHy/10/
Select boxes are operating system controls not true HTML rendered elements, so they often do not behave as normal HTML elements would.