Skip to main content

Bug Tracker

Side navigation

#1030 closed bug (duplicate)

Opened March 07, 2007 04:09PM UTC

Closed May 13, 2007 01:52AM UTC

Last modified June 21, 2007 03:36AM UTC

value attribute on <option/> element required on IE

Reported by: jimfuller2007 Owned by:
Priority: major Milestone: 1.1.3
Component: core Version: 1.1.2
Keywords: Cc:
Blocked by: Blocking:
Description

When using a selector such as;

$('select#age').val()

to get current selected value (in this case a drop down containing age ) from a <select/> element.

Internet Explorer (IE) doesnt fallback to use node content...e.g. needs value attribute

ex. doesnt work

<option>1</option>

ex. works

<option value="1">1</option>

checking on firefox this is not a problem, on IE 6 up to IE 7 (win 2000 and winxp)

cheers, Jim

Attachments (0)
Change History (2)

Changed March 07, 2007 10:08PM UTC by malsup comment:1

This is not a bug. The val() method makes no attempt at solving cross-browser issues like this. It simply returns the current value of the element's value property. FF implicitly promotes an option element's text to the value property if the value attribute is missing.

Changed May 13, 2007 01:52AM UTC by brandon comment:2

description: When using a selector such as;\ \ $('select#age').val()\ \ to get current selected value (in this case a drop down containing age ) from a <select/> element.\ \ Internet Explorer (IE) doesnt fallback to use node content...e.g. needs value attribute\ \ ex. doesnt work\ \ <option>1</option>\ \ ex. works\ \ <option value="1">1</option>\ \ checking on firefox this is not a problem, on IE 6 up to IE 7 (win 2000 and winxp)\ \ cheers, Jim\ \ \ When using a selector such as; \ \ $('select#age').val() \ \ to get current selected value (in this case a drop down containing age ) from a <select/> element. \ \ Internet Explorer (IE) doesnt fallback to use node content...e.g. needs value attribute \ \ ex. doesnt work \ \ <option>1</option> \ \ ex. works \ \ <option value="1">1</option> \ \ checking on firefox this is not a problem, on IE 6 up to IE 7 (win 2000 and winxp) \ \ cheers, Jim \ \ \
need: → Review
resolution: → duplicate
status: newclosed

Duplicate of 1008