Bug Tracker

Ticket #6026 (closed bug: worksforme)

Opened 6 years ago

Last modified 6 years ago

.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:
Blocking: Blocked by:


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 &amp; Engineering</option> <option value="3">Chemicals &amp; Plastics</option> <option value="4">Defence</option> <option value="5">Food &amp; Drink</option> <option value="6">General Manufacturing</option> <option selected="selected" value="7">Healthcare</option> <option value="8">Paper &amp; Packaging</option> <option value="9">Pharmaceuticals &amp; Medical Products</option>


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

<input type="submit" name="submit" value="Go &gt;" />


Change History

comment:1 Changed 6 years ago by john

  • Status changed from new to closed
  • Resolution set to worksforme

This was fixed in jQuery 1.4.1.

comment:2 Changed 6 years ago by Stormrider

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

Note: See TracTickets for help on using tickets.