[英]jQuery UI Tabs beforeLoad preventDefault is not working
Somehow the e.preventDefault()
on the beforeLoad()
event in jQuery UI Tabs is not working. 不知怎的, e.preventDefault()
在beforeLoad()
在jQuery UI的标签事件不工作。 Here is a little example: 这是一个小例子:
<div id="tabs">
<ul>
<li><a href="#exampleExistingTab">Existing Tab</a></li>
<li><a href="/path/to/remote/tab">Remote Tab</a></li>
</ul>
<div id="#exampleExistingTab"><h3>Hello There!</h3></div>
</div>
<script type="text/javascript">
$('#tabs').tabs({
beforeLoad: function (e, ui) {
e.preventDefault();
}
});
</script>
For sure this is not the real script, just an example to show the mistake. 确保这不是真正的脚本,仅是显示错误的示例。 I think the remote tab should never be loaded, but the ajax request is fired every time you click the "Remote Tab" (and it's not active before). 我认为应该永远不要加载远程选项卡,但是每次您单击“远程选项卡”时,都会触发ajax请求(并且之前未处于活动状态)。
Anyone know about this issue or how to fix this? 任何人都知道这个问题或如何解决?
Tested with: Mozilla Firefox 24.0; 经过测试:Mozilla Firefox 24.0; jquery 1.10.2; jQuery 1.10.2; jqueryUi 1.10.3 的jqueryUi 1.10.3
Im not sure e.preventDefault() works like that in this case. 我不确定e.preventDefault()在这种情况下是否能像这样工作。
Since the "ui" parameter has a jqXHR object, have you tried doing: 由于“ ui”参数具有jqXHR对象,您是否尝试过这样做:
ui.jqXHR.abort();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.