Skip to main content

Bug Tracker

Side navigation

#5399 closed bug (worksforme)

Opened October 20, 2009 11:18AM UTC

Closed November 19, 2010 02:18AM UTC

Last modified March 15, 2012 11:39AM UTC

Form option element not hiding in IE

Reported by: antonycarthy Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: select option hide Cc:
Blocked by: Blocking:
Description

The option elements in forms do not hide as expected. I assume this is known, but I cant find much on the web about it. The following code does not hide the option elements in the form select as expected in IE (up to 8) and perhaps in other browsers:

$('option').hide();

Is this a problem with option {display: hidden;} in IE?

This may be related to ticket #5396.

Attachments (0)
Change History (4)

Changed October 20, 2009 04:23PM UTC by JeffMatthews comment:1

Yes, it is the same issue.

Note, also, that in FireFox, it is not quite right, either (but much better).

The <select> allows you to type the first letter in order to achieve a rapid scroll to the first option that matches that letter.

If you press a letter, FFox will jump to and display the hidden option, although, it will not let you select it.

Changed October 20, 2009 11:34PM UTC by dmethvin comment:2

If the browsers handle this edge case differently, why not use a method that works in all of them? For example, just remove the options that are "hidden" from the list of options if they are not currently valid, or disable them. Will that suit this use-case? Can you point to some examples?

Changed October 21, 2009 03:59PM UTC by JeffMatthews comment:3

I suppose it could be done that way, provided it worked. But still, it would require burdensome coding to make it happen.

For example, look at http://sovereignstates.net/StateLegislators/VSLegTracker.php

The behavior is shown in the drop down for the "Pick a state" options. If you pick "House" in the "Chamber" options, California should hide because it does not have a House. It has an Assembly.

You can see it hides in FFox, but not IE or Chrome. But check the keypress feature by pressing "C" in FFox, and California will display. So, really, none of them work as they should.

Now, to do the work-around suggested by actually removing these elements would mean storing removed elements in an array and accessing the array to get them back by appending into options. Sort of a "Recycle Bin," if you will. This would be required because you have to remember the name, value, id, class, style, etc. of the element. So, to store all that and hope you don't miss anything could be a pain, and probably asking for unwanted bugs.

Actually, what would probably be best is to have some Jquery code that performs like option and just scrap HTML's option altogether.

Changed November 19, 2010 02:18AM UTC by dmethvin comment:4

resolution: → worksforme
status: newclosed