Skip to main content

Bug Tracker

Side navigation

#440 closed bug (worksforme)

Opened November 26, 2006 10:39AM UTC

Closed November 30, 2006 08:05PM UTC

Last modified June 19, 2007 03:46PM UTC

Getting value for option element with no value attribute set (IE)

Reported by: joern Owned by:
Priority: major Milestone:
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:

If we declare a combo box in a form without the value attribute we can´t get the value in internet Explorer.


<select id="combo" name="combo">
<option selected>3</option>


This doesn´t work on ie.

We must declare the select with the attribute value:

<select id="combo" name="combo">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected>3</option>


This works now on ie.

Could be it´s a bug. I only wanted to notice the jquery team. Thanks for reading.

It's a good question if this is a bug or not. If I remember it correctly, the value of an option element should be it's text content if the value attribute isn't set. In that case, it should be possible for jQuery to handle it, that is, check if the value attribute exists and get the text if it doesn't.

Attachments (0)
Change History (4)

Changed November 27, 2006 04:04PM UTC by joern comment:1

resolution: → wontfix
status: newclosed

I don't think this can be fixed by jQuery. Consider this example:

<select id="combo" name="combo">
<option value="">Please select...</option>
<option value="2">2</option>
<option value="3">3</option>


Now if jQuery gets the text of the selected option element when the value is empty, it would return "Please select..." instead of an empty string, now quite what we want.

A decent check if the value attribute exists or not should be added to the formField method of the form plugin, not into core.

Changed November 29, 2006 11:31PM UTC by aaron.heimli comment:2

I agree with Joern on this, especially if all of the shortcuts are getting removed from the core in 1.1

Changed November 30, 2006 12:04AM UTC by bhb@iceburg. comment:3

resolution: wontfix
status: closedreopened

I disagree and think that this should be fixed.

The *Bottom Line* is that IE submits a value of "b" for "combo" if the following select is left untouched.


<form action="" method="GET">

<select name="s">


<option SELECTED>b</option>



<input type="submit">



I think that jQuery's .val() should always reflect the value that gets SUBMITTED. What do you guys think?

Changed November 30, 2006 08:05PM UTC by joern comment:4

resolution: → worksforme
status: reopenedclosed

Aaron found a solution to this and Mike integrated it into the form plugin.