IE8中的jQuery 1.7.1 ButtonSet没有一致地触发更改事件 [英] jQuery 1.7.1 ButtonSet in IE8 not consistently firing the change event
问题描述
仅在IE8中查看jQuery UI按钮组的问题。在IE 8下,按钮组不会一直触发更改事件。
Seeing a problem with a jQuery UI buttonset in IE8 only. Under IE 8, the buttonset does not consistently fire the change event.
<!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>
出现时外观大致正常。每个人都是一致的。按钮角不是圆形的。当我点击按钮时,它们会压下。
The appearance is mostly fine when it comes up. Everybody is aligned. The button corners are not rounded. When I click on the buttons, they do depress.
但是,我可以来回点击很多次,而且变更事件似乎是随机发生的。它完全不一致。
But, I can click back and forth a bunch of times and the change event seems to fire randomly. It's totally inconsistent.
在Chrome下,每次都会触发。
Under Chrome, it fires every single time.
有什么想法吗?
这是关于SO的相关问题。它说支持click事件。在我提交之后我会尝试,但这不是我想要的助记符。我想要更改。
This is a related question on SO. It says to support the click event. I'll try that after I submit this, but that's not the mnemonic that I want. I want "change".
推荐答案
仅当控件失去焦点时,Internet Explorer才会触发更改事件。因此,它基本上是破碎的,并且用于很多目的。使用点击确实是最好的选择。
Internet Explorer fires the "change" event only when the control loses focus. It's basically broken and useless for a lot of purposes, therefore. Using "click" is really the best alternative.
这篇关于IE8中的jQuery 1.7.1 ButtonSet没有一致地触发更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!