jQuery UI 检查按钮不会保持突出显示 IE 8
我正在使用 带有复选框的 jQuery UI 按钮元素。这个想法是作为一个切换按钮。按钮被按下并保持在“按下”/“活动”状态,直到再次单击它,它实际上是一个带有按钮的复选框,作为用户的可视界面。
我的问题是该按钮在 Internet Explorer 中没有保持按下状态。它在其他浏览器中可以正常工作。因此,当我单击该按钮,然后按页面上的其他任何位置时,该按钮现在将显示为未按下/默认/不活动。
JavaScript:
$('#btnOptions').button({
icons: {
primary: "ui-icon-wrench"
}
})
$('#btnOptions').click(function (event) {
event.preventDefault();
LoadOptions();
});
HTML:
<input type="checkbox" id="btnOptions" /><label for="btnOptions">Options</label>
有什么想法吗? 谢谢
I am using the jQuery UI Button element with a Checkbox. The idea is that this works as a Toggle button. The button is pressed and stays in the 'pressed'/'active' state until it is clicked again, it is a effectively a checkbox with a button as a visual interface to the user.
My problem is that the button does not stay in the pressed state in Internet Explorer. It works correctly in other browsers. So when if I click the button, and then press anywhere else on the page, the button will now appear unpressed/default/inactive.
JavaScript:
$('#btnOptions').button({
icons: {
primary: "ui-icon-wrench"
}
})
$('#btnOptions').click(function (event) {
event.preventDefault();
LoadOptions();
});
HTML:
<input type="checkbox" id="btnOptions" /><label for="btnOptions">Options</label>
Any ideas?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原来我是个白痴!
这行代码的作用是:
我将其作为惯例,因为当按钮是链接时,我用它来防止页面跳转到顶部。然而这一次它阻止了默认行为!
所以有效的代码如下:
Well turns out I am an idiot!
This line of code it what was doing it:
I had this in there as a convention because when the buttons are links, I use that to prevent the page jumping to the top. However this time it was preventing the default behaviour!
So code that works is as follows: