Powered by Blogger.

How to make unselectable dropdown option



If you want to make some options in a select/dropdown that can not be selected then you may take the following way. No other javascript or jQuery required, just simple.

Here is a sample:


Here are the codes:
<select name="wpprogramming-com-unselectable-dropdown">
  <option value="0">Please select</option>
  <optgroup label="WPProgramming.com - WordPress">
    <option value="1">WPProgramming.com - 1 </option>
    <option value="2">WPProgramming.com - 2 </option>
  </optgroup>
  <optgroup label="WPProgramming.com - jQuery">
    <option value="3">WPProgramming.com -  3</option>
    <option value="4">WPProgramming.com -  4</option>
    <option value="5">WPProgramming.com -  5</option>
  </optgroup>
</select>

No comments