jQuery problem with change event and IE8

Posted by Marcus on Stack Overflow See other posts from Stack Overflow or by Marcus
Published on 2010-06-17T11:10:38Z Indexed on 2010/06/17 11:13 UTC
Read the original article Hit count: 414

Filed under:
|
|

There is a bug in jQuery 1.4.2 that makes change event on select-element getting fired twice when using both DOM-event and a jQuery event, and this only on IE7/8. Here is the test code:

<html>

<head>
    <script src="http://code.jquery.com/jquery-1.4.2.js" type="text/javascript"></script>

    <script type="text/javascript">

       jQuery(document).ready(function() {

         jQuery(".myDropDown").change(function() {


         });

       });

    </script>

</head>

<body>
    <select class="myDropDown" onchange="alert('hello');">
          <option>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
        </select>
</body>

</html>

Ticket to actual bug: http://dev.jquery.com/ticket/6593

This causes alot of trouble for us in our application cause we use both ASP.NET-events mixed with jQuery and once you hook up a change event on any element every select (dropdown) gets this double firing problem.

Is there anyone who knows a way around this in the meantime until this issue is fixed?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery