아마도 다음과 같습니다.
<SELECT NAME="browser" VALUE=""
onchange="var opt=this.options[0];if(opt.getAttribute('role')==='placeholder'&&!opt.selected)opt.parentNode.removeChild(opt);">
<option role="placeholder" value="">Which Web browser do you use most often?</option>
<OPTGROUP LABEL="Firefox">
<OPTION LABEL="2.0 or higher">
Firefox 2.0 or higher
</OPTION>
<OPTION LABEL="1.5.x">Firefox 1.5.x</OPTION>
<OPTION LABEL="1.0.x">Firefox 1.0.x</OPTION>
</OPTGROUP>
<OPTGROUP LABEL="Microsoft Internet Explorer">
<OPTION LABEL="7.0 or higher">
Microsoft Internet Explorer 7.0 or higher
</OPTION>
<OPTION LABEL="6.x">Microsoft Internet Explorer 6.x</OPTION>
<OPTION LABEL="5.x">Microsoft Internet Explorer 5.x</OPTION>
<OPTION LABEL="4.x">Microsoft Internet Explorer 4.x</OPTION>
</OPTGROUP>
<OPTGROUP LABEL="Opera">
<OPTION LABEL="9.0 or higher">Opera 9.0 or higher</OPTION>
<OPTION LABEL="8.x">Opera 8.x</OPTION>
<OPTION LABEL="7.x">Opera 7.x</OPTION>
</OPTGROUP>
<OPTION>Safari</OPTION>
<OPTION>Other</OPTION>
</SELECT>
OPTION
사용자 정의 태그 role="placeholder"
가 SELECT
제대로 작동하려면 먼저 내부 에 배치해야합니다 .
이 같은?
<form>
<select onchange="document.getElementById('placeholder').disabled=true">
<option selected="selected" id="placeholder">please select something</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</form>
이 예에서 옵션은 사용자에게 계속 표시되지만 클릭 할 수는 없습니다.
출처
https://stackoverflow.com/questions/7415158