IE8中的jQuery 1.7.1 ButtonSet没有始终触发更改事件

时间:2012-02-18 22:16:31

标签: jquery jquery-ui internet-explorer-8

仅在IE8中查看jQuery UI按钮组的问题。在IE 8下,按钮组不会一直触发更改事件。

<!DOCTYPE html>
<html>
<head>

<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/south-street/jquery-ui.css" rel='stylesheet' type='text/css'>

<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.11/jquery-ui.js"></script>

<script language="javascript">

    $(document).ready(function () {
        $("#toolGroup").buttonset();
        $("#toolGroup").change(
        function () {
            alert("hi");
        }
        );
    });

</script>
</head>
<body>

    <div id="toolGroup">
        <input name="marker" type="radio" id="check1" value="point" checked /><label for="check1"><img src="/images/point.png" width="40" /></label>
        <input name="marker" type="radio" id="check2" value="line" /><label for="check2"><img src="/images/line.png" width="40" /></label>
        <input name="marker" type="radio" id="check3" value="polygon" /><label for="check3"><img src="/images/polygon.png" width="40" /></label>
    </div>

</body>
</html>

出现时外观大多都很好。每个人都是一致的。按钮角不是圆角。当我点击按钮时,它们会压下。

但是,我可以来回点击很多次,变化事件似乎随机发生。它完全不一致。

在Chrome下,它每次都会触发。

有什么想法吗?

This is a related question on SO.它说支持点击事件。在我提交之后我会尝试,但这不是我想要的助记符。我想&#34;改变&#34;。

1 个答案:

答案 0 :(得分:1)

Internet Explorer触发&#34;更改&#34;只有当控件失去焦点时才会发生事件。因此,它在很多方面基本上都是破碎和无用的。使用&#34;点击&#34;真是最好的选择。