开发者

live change handlers in jQuery 1.4 don't work for select elements in IE

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">
<html><head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<title>jQuery live开发者_如何学Python change handler test</title>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<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>


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜