473,671 Members | 2,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Hide the Options in select

8 New Member
Hi Every one,

My Problem is, I want to hide the options in drop down.

As an example, I have code as
Expand|Select|Wrap|Line Numbers
  1.  
  2.                          <SELECT>
  3.                                         <OPTION>NAME</OPTION>
  4.                                         <OPTION>REG.NO</OPTION>
  5.                                         <OPTION>STATE</OPTION>
  6.                         </SELECT>
In this i want hide option REG.NO. How to do it.I will be very thankfull to every one .
Nov 23 '06 #1
15 92563
AricC
1,892 Recognized Expert Top Contributor
What do you mean you want to hid the option? Do you want to disable it or make the one select option disabled?
Nov 25 '06 #2
ronverdonk
4,258 Recognized Expert Specialist
The easiest way to hide an option in a drop down list is not to show it at all. That is the purpose of a drop down? To let a user select. If you don't want him/her to select, dont't show it.

Ronald :cool:
Nov 25 '06 #3
AricC
1,892 Recognized Expert Top Contributor
What you should do is have an option above like a radio button then depending on what they pick the drop down will load with only the values dependent on the radio buttons.

HTH,
Aric
Nov 26 '06 #4
Nageshwarrao
8 New Member
What do you mean you want to hid the option? Do you want to disable it or make the one select option disabled?

I want to disable one select option.
Nov 27 '06 #5
Decebal
1 New Member
I have the same problem. I found a solution which works excelent in Firefox but not in IE. :(

This works in Firefox:
Expand|Select|Wrap|Line Numbers
  1. if(hyde == 1)
  2.   document.FormName.SelectName.options[2].style.display = 'none';
  3. else
  4.   document.FormName.SelectName.options[2].style.display = 'block';
Does anybody know how to make it work in IE ???

---
Dec 7 '06 #6
The Inologist
1 New Member
I also am having the same problem. The following works in Firefox but not IE.

Expand|Select|Wrap|Line Numbers
  1. <SELECT>
  2. <OPTION>NAME</OPTION>
  3. <OPTION style="display:none;">REG.NO</OPTION>
  4. <OPTION>STATE</OPTION>
  5. </SELECT>
Did any one have any success in hiding options in Internet Explorer?

Regards,

John
Jan 4 '07 #7
acoder
16,027 Recognized Expert Moderator MVP
To hide options in IE, you'll need to remove the options completely.
Jul 12 '08 #8
firstposter
8 New Member
I have a similar problem i'm trying to solve

I doubt if its possible but could you somehow use javascript to add/remove html comments to the option tags that are not needed. (I wish we could use css display:none!!)

eg

Expand|Select|Wrap|Line Numbers
  1. <select>
  2.       <option>value1</option>
  3. <!-- <option>value2</option> -->
  4.       <option>value3</option>
  5.       <option>value4</option> 
  6. </select>
I'm trying to create second dependent dropdown list

eg dropdown 1 is a list of say countries. dropdown 2 is for cites.

Im using php to to generate the first and second dropdown.

The second dropdown has all possible options for for each option in the first dropdown. This means that if javascript is disabled all options would be listed in the second dropdown. if javascript is enabled the second dropdown list is shortened. It would show/hide options in the second dropdown each time the first dropdown list changes

i hope that all makes sense - can anyone help
Aug 30 '09 #9
gits
5,390 Recognized Expert Moderator Expert
so to understand you correctly .... both of the lists are basicly populated already on the page?
Aug 30 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2657
by: Jared | last post by:
Hi there I am trying to do the following with no luck: I want to have a form with two select menus. Each menu will obvisouly have different options, each with its own value. Then quite simply, when the user clicks on the submit button, I want the resulting URL to include options from the select fields ( ie: whatever the user has selected.) For eg: for a date URL, the final URL might be:
2
7982
by: Wim Roffal | last post by:
I want to insert an option into a select. I know you can do something like: - Myselect.options = new Option('Hello 3'); but that doesn't do what I want because it overwrites an existing option. I have the existing options ordered on alphabet and the new option should fit in on the right place. Of course I can move all the options that come after the new one, but I wondered if there is a smarter way to do this.
1
6653
by: comp.lang.javascript | last post by:
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 }
2
6430
by: Joachim Bauer | last post by:
I'm using the code below to display a menu that opens when the mouse goes over the main menu item (try it in your browser to understand the behaviour). It uses "position:absolute" and a switch between "display='none'" and "display=''". However the problem is that - in Internet Explorer 6 the dropdown (<select>...) always hides the menu
2
1953
by: Dave Hammond | last post by:
I'm not sure if this is technically a javascript question, but I'm coding in javascript, so I'll try here first. To overlay a section of a page I typically use an absolute positioned <div> and call insertAdjacentHTML. By raising the z-index higher than than the underlying elements this method works fine, except if there is a window'd element below it, such as a <select>. My understanding is that I need to use the visbility attribute to...
2
6193
by: mitch | last post by:
I have a <select> that's inside a <td> and I want to dynamically show and hide the select. If elem is set to the <select> and I do either of these: elem.style.visibility = "hidden"; elem.style.display = "none"; it works in Firefox, but not in IE. In IE the page doesn't change at all.
6
4761
by: work.Yehuda | last post by:
This script will work only width Firefox browser <select id='object'> </select> document.getElementById(abject).innerHTML= '<option>yehuda' For some reason the Explorer browser doesn't refer to the options inside a select box as an innerHTML object
4
6019
by: Luqman | last post by:
I have populated the Child Accounts and Parent Accounts in a Grid View Control, I want to hide the Select Column of Parent Accounts, but not the Child Accounts, is it possible ? I am using VS 2005 ? Best Regards, Luqman
3
1974
by: Italio Novuas | last post by:
Hi all, let me begin by saying that I *ALMOST* have this complete! What I'm trying to do is make it so my text area shows the innerHTML of any select item with the same value. For example, if I have a select list with 5 options: <select name="select" onChange="changeValues();"> <option value="1">Option 1</option> <option value="1">More stuff on option 1</option> <option value="1">EVEN more option one stuff!!</option> <option...
0
8912
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.