Skip to main content

Bug Tracker

Side navigation

#6026 closed bug (worksforme)

Opened February 04, 2010 12:54PM UTC

Closed February 04, 2010 01:34PM UTC

Last modified February 04, 2010 02:06PM UTC

.change() handler fired when clicking select box in IE

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

When creating a dropdown box / menu and using the .change() event to bind a function to submit the form, in IE it triggers the function when clicking the select box.

When the page first loads, it works fine for the first time, then it fails for subsequent attempts - possibly because a selected="selected" has been added to one of the options by then (using server-side scripting). Tested in IE 7 & 8.

<script>

$(function() {

$('#industry-form input[type=submit]').remove();

$('#industry-form select').change(function() {$('#industry-form').submit()});

});

</script>

<p>Please select the sector you are interested in from the drop-down box below:</p>

<form id="industry-form" action="index.php" method="get">

<select name="sector">

<option value="0">[Select Industry]</option>

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

<option value="2">Automotive & Engineering</option>

<option value="3">Chemicals & Plastics</option>

<option value="4">Defence</option>

<option value="5">Food & Drink</option>

<option value="6">General Manufacturing</option>

<option selected="selected" value="7">Healthcare</option>

<option value="8">Paper & Packaging</option>

<option value="9">Pharmaceuticals & Medical Products</option>

</select>

<input type="hidden" name="ar" value="144" />

<input type="submit" name="submit" value="Go >" />

</form>

Attachments (0)
Change History (2)

Changed February 04, 2010 01:34PM UTC by john comment:1

resolution: → worksforme
status: newclosed

This was fixed in jQuery 1.4.1.

Changed February 04, 2010 02:06PM UTC by Stormrider comment:2

Fair enough, it wasn't in the Changelog so assumed it wasn't known about. Confirmed it works for me in 1.4.1.