views:

478

answers:

2

I recently decided to try jQuery 1.4, excited that I would finally have support for live event handlers that work for change events in IE. However, it seems like they don't always work. If I try to assign a live change handler on a select element, it doesn't work when I change it in IE.

I tried this in IE 6, 7, and 8. In every other browser I tried (Firefox, Chrome, Safari), it works fine. I tried putting the command to assign the handler within the ready function, and that didn't fix it.

Does anyone have any idea what is causing this or what I can do to fix it? Am I doing something wrong, or is this a bug in jQuery? Here is an example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"&gt;
<html><head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<title>jQuery live change handler test</title>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"&gt;&lt;/script&gt;
<select id="test">
    <option value="a">a
    <option value="b">b
</select>
<script type="text/javascript">
$("#test").live("change", function() {
    alert('hi');
});
</script>
</body></html>
A: 

from here

Possible event values: click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, keydown, keypress, keyup

Currently not supported: blur, focus, mouseenter, mouseleave, change, submit

change, my friend, is not yet supported by live

ram
That's the documentation for jQuery 1.3. See here for 1.4 - http://api.jquery.com/live/ It says - "As of jQuery 1.4, the .live() method supports custom events as well as all JavaScript events. Two exceptions: Since focus and blur aren't actually bubbling events, we need to use focusin and focusout instead."
Chetan Sastry
Chetan -you are right !!! My apologies mikez!!
ram
+3  A: 

Looks like it has been fixed. Not sure when it goes live.

Ticket - http://dev.jquery.com/ticket/5851

GitHub commit - http://github.com/jquery/jquery/commit/435772e29b4ac4ccfdefbc4045d43f714e153381

Chetan Sastry
One of the programmers made a post saying that the fix will be released by Friday.
mikez302
Sorry, I forgot to post the link.http://groups.google.com/group/jquery-dev/browse_thread/thread/e74de6015020d160#msg_25e7da221c65515b
mikez302
The fix has been released. You can get it at http://jquery.com/.
mikez302