Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#10472 closed bug (invalid)

jquery-1.6.2 not changing select (default) element in Firefox when default is first

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:


Attempting to change the value of select drop-down fails without error on Firefox 7.0.1 when the option changing from is the first option in the list.

I tested this on Chrome and Safari and found it to work as expected.

The script used is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
		<script src="js/jquery-ui-1.8.16.custom/js/jquery-1.6.2.min.js" type="text/javascript"></script>

		<div class="chrtTimeSelect">
			<select id="chrt_time">
				<option value="1" selected="selected">24 hours</option>
				<option value="2">6 months</option>
				<option value="3">1 year</option>
				<option value="4">5 years</option>
				<option value="5">10 years</option>
				<option value="6">20 years</option>



				var time_selection = "5";

				$("#chrt_time option[selected]").removeAttr("selected");
				$("#chrt_time option[value=" + time_selection + "]").attr("selected", "selected");



Change History (4)

comment:1 Changed 11 years ago by dmethvin

Resolution: invalid
Status: newclosed

Attributes aren't dynamic. Use .val() on the select or .prop() on the option element you want to select:


comment:2 Changed 11 years ago by [email protected]

It didn't work even if i use .val()...

comment:3 Changed 10 years ago by anonymous

I have the same problem... Someone found any solution?

comment:4 Changed 10 years ago by anonymous

Solution founded! Use ".removeAttr("selected").removeAttr("selected")".

Note: See TracTickets for help on using tickets.