473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Hiding OPTIONS in SELECT ?

Using IE5.5+, is it possible to hide options in a select?

The following doesn't work:

<HTML>
<HEAD>
<STYLE>
SELECT OPTION.orgA{ display:none }
.orgB{ display:inline }
.orgC{ display:none }
</STYLE>
</HEAD>
<BODY>
<SELECT id=cbo size=3>
<OPTION class="orgA">RTI</OPTION>
<OPTION class="orgB">LAB</OPTION>
<OPTION class="orgC">TCI</OPTION>
</SELECT>
</BODY>
</HTML>

Best Regards,
Jesse Wade
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
1 6634
"comp.lang.javascript" wrote:
Using IE5.5+, is it possible to hide options in a select?

The following doesn't work:

<HTML>
<HEAD>
<STYLE>
SELECT OPTION.orgA{ display:none }
.orgB{ display:inline }
.orgC{ display:none }
</STYLE>
</HEAD>
<BODY>
<SELECT id=cbo size=3>
<OPTION class="orgA">RTI</OPTION>
<OPTION class="orgB">LAB</OPTION>
<OPTION class="orgC">TCI</OPTION>
</SELECT>
</BODY>
</HTML>

Best Regards,
Jesse Wade


If you want to have items dynamically appear and disappear from a
<select> you're going to have to remove the references to the
actual <option> objects and recreate them when you want them
"visible":

document.getElementById{'cbo').options[1] = null;
var select = document.getElementById('cbo');
select.options[select.option.length] = new Option(...);

Of course that adds it to the bottom, if you want it added at the
cursor position or in sorted order, you'll have to re-order the
<option> objects after you add the new ones.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ben | last post by:
I have a form for data entry which is in a table. I have a select box to enter a customer name, which takes it's options from the customer database. I have a button to add a new customer. What I...
2
by: c.anandkumar | last post by:
Hi All - I have some problems getting a small piece of javascript working correctly for Firefox. Here is what I am trying to do - 1. I have a form (like a search form) 2. I have many groups...
3
by: Frank K. | last post by:
Hello, Hoping someone can help me out. When I select all records in a table, copy them to the clip board, and paste them to Excel the names of the fields appear in the first row in Excel....
7
by: Dennis | last post by:
I have a class named myclass that inheirits from "baseclass". There is a property of "baseclass" that I don't want exposed in the IDE. The MSDN documentation says" "A derived type can hide an...
1
by: roland-d | last post by:
Hello all, Toggling divs is a popular subject and I have found plenty of information and was able to make it work. There is only 1 thing I am still stuck with for quite some time. I have a...
2
by: sasierkha | last post by:
I have two options yes and no in option button when the user select the option yes it has two textbox with required field validator if value is entered no pbm otherwise error message will be...
3
Jerry911
by: Jerry911 | last post by:
I have a form that uses a pick list to select a specified date/time range based on the case value. Case 1-7 have pre-defined date/time functions, but case 8 is for a custom date/time range. I only...
1
by: Malinmore | last post by:
the following works well regarding one select box with one hidden text box. however I need two unique select boxes with relevant hidden text boxes that un-hide when the Add New option is selected....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.