[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

disabled in select option not working

Posted on 2000-02-03
6
Medium Priority
?
142 Views
Last Modified: 2010-04-09
Hi, I'm trying to create a listbox with 6 elements, the top one of which will be disabled (i.e. not clickable).

I'm including the 'disabled' parameter in the option statement, but it seems to ignore it.

It's in my HTML manual under both 'option' and 'select', it works ok under 'select', but I only want the ability to disabled individual list items.

This is my code...

<select name='fred' size=6>
 <option disabled>Title</option>
 <option value='2-1'>Free</OPTION>
 <option value='2-2'>Free</OPTION>
 <option value='2-3'>Free</OPTION>
 <option value='2-4'>Free</OPTION>
 <option value='2-5'>Free</OPTION>
</select>

But the first item in the list is not disabled, i.e. you can click on it..

Is this a disabled feature ??

I'm using IE5.
0
Comment
Question by:smegghead
  • 3
  • 2
6 Comments
 

Expert Comment

by:crazyhead
ID: 2485811
Try "enabled='false'", or "disabled='true'". That might work.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2485855
<SCRIPT language='javascript'>
  var myndx = -1;
</script>

<select name='fred' size=6 onChange='if(this.selectedIndex==0){this.selectedIndex=myndx}else{myndx=this.selectedIndex}'>
   <option value='disabled'>Title</option>
   <option value='2-1'>Free</OPTION>
   <option value='2-2'>Free</OPTION>
   <option value='2-3'>Free</OPTION>
   <option value='2-4'>Free</OPTION>
   <option value='2-5'>Free</OPTION>
</select>
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 200 total points
ID: 2485880
Add the style clause in the top option and it looks gray:

<SCRIPT language='javascript'>
 var myndx = -1;
</script>

<select name='fred' size=6 onChange='if(this.selectedIndex==0){this.selectedIndex=myndx}else{myndx=this.selectedIndex}'>
  <option value='' style='color=gray;'>Title</option>
  <option value='2-1'>Free</OPTION>
  <option value='2-2'>Free</OPTION>
  <option value='2-3'>Free</OPTION>
  <option value='2-4'>Free</OPTION>
  <option value='2-5'>Free</OPTION>
</select>
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 33

Expert Comment

by:knightEknight
ID: 2491491
BTW the code above works in both Netscape and IE
0
 
LVL 10

Author Comment

by:smegghead
ID: 2492579
Thank You, I'll give it a go on Monday.. looks good though.
0
 
LVL 10

Author Comment

by:smegghead
ID: 2522397
Thank you, and sorry about the delay.. (but I didn't say which Monday though - ha ha)

Don't suppose you know how to change the 'bgcolor' of an <option> do you ??
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

640 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question