Jump to content

disable select


Little Goat

Recommended Posts

ok, ive seen some <select> dropdown menus hav it so that if you try to select one option, it wont let you. (such as the jump menu on this site)anyone know how to do this?thnx, LG

Link to comment
Share on other sites

ok, ive seen some <select> dropdown menus hav it so that if you try to select one option, it wont let you. (such as the jump menu on this site)anyone know how to do this?thnx, LG

Something like this?
<script type="text/javascript"><!--function check(menu){if (menu.selectedIndex == 2) alert('Nope!')else alert('OK!');menu.selectedIndex = 0; //reset selection}//--></script><select onchange="check(this)"><option value="-">-</option><option value="1">1</option><option id="se2"value="2">2</option><option value="3">3</option><option value="4">4</option></select>

edit: added id se2 to get this work:document.getElementById('se2').disabled = 'disabled';to get element back to enabled:document.getElementById('se2').disabled = '';seems disabled is not working with MSIE? all real browsers it works ok.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...