Skip to main content

Bug Tracker

Side navigation

#5959 closed bug (fixed)

Opened January 27, 2010 08:26PM UTC

Closed October 02, 2010 06:24PM UTC

Change event for Select element getting fired on click (occuring in 1.4.1)

Reported by: noelmccrory Owned by: brandon
Priority: major Milestone: 1.4.2
Component: event Version: 1.4.1
Keywords: Cc:
Blocked by: Blocking:
Description

See the following example:

<script type="text/javascript">

$(document).ready(function(){

$('#dropDownList1').bind('change',function(){

alert("changed"); });

$('#btnChange').click(function(){

$('#dropDownList1')[0].selectedIndex = 0;

//Note: Setting the val() of the select list instead does not make a difference to the outcome of this test

});

});

</script>

<select id="dropDownList1">

<option value="0">0</option>

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

<option value="2">2</option>

</select>

<a href="#" id="btnChange">Change</a>

Execute the following steps:

1. Choose "2" from the select list.

2. Click the "Change" link.

3. Click the select list.

When you click the select list in the 3rd step, an alert containing "changed" appears. This does not appear in version 1.3.2.

Attachments (1)
  • test.zip (23.5 KB) - added by noelmccrory January 27, 2010 08:29PM UTC.
Change History (4)

Changed January 27, 2010 08:30PM UTC by noelmccrory comment:1

I should have mentioned that this problem is occuring in both IE 7 and 8. It does not occur in Firefox 3.5.7 though.

Changed February 15, 2010 11:38PM UTC by simshaun comment:2

Would just like to say its happening for me as well using 1.4.1, under a slightly different circumstance. (Happens under IE6, IE7, and IE8)

I've got a "Choose Photo Gallery" dropdown with several options. The dropdown has an onChange event binded to it; When the dropdown changes, the window.location is set to whatever the selected option's value is. In other words, the page reloads with a different query string whenever an option is chosen. When the page loads, an option is selected by default based on a parameter in the query string (handled by PHP, not JavaScript).

When an option that is NOT the first option is selected by default, anytime I click the dropdown in IE it fires the onChange event, even though I did not choose an option.

Changed February 28, 2010 11:08PM UTC by noelmccrory comment:3

This appears to have been fixed in 1.4.2.

Nothing in the release notes about it, but thanks anyways!

Changed October 02, 2010 06:24PM UTC by snover comment:4

resolution: → fixed
status: newclosed