Dean Gibson Dean Gibson - 1 year ago 168
HTML Question

Disable/readonly select tag in html

How exactly can I go about making a select tag readonly. I've read that you can't set a select as readonly. I do that I can set it as disabled but... That is not an option. I would like the user to view the rest of the options in the select tag, but not be able to pick one of them..

Any ideas?

Answer Source

you can use disabled attribute.

for example.

<select >
  <option disabled="disabled" value="volvo">Volvo</option>
  <option disabled="disabled" value="saab">Saab</option>
  <option disabled="disabled" value="mercedes">Mercedes</option>
  <option disabled="disabled" value="audi">Audi</option>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download