Bug Tracker

Ticket #1030 (closed bug: duplicate)

Opened 2 years ago

Last modified 1 year ago

value attribute on <option/> element required on IE

Reported by: jimfuller2007 Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.1.3 Component: core
Version: 1.1.2 Keywords:
Cc: Needs: Review

Description (last modified by brandon) (diff)

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

Change History

Changed 2 years ago by malsup

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 2 years ago by brandon

  • need set to Review
  • status changed from new to closed
  • resolution set to duplicate
  • description changed from 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 to 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

Duplicate of 1008

Note: See TracTickets for help on using tickets.