检测选项卡在jQueryUI下被选中 [英] Detecting tab getting selected under jQueryUI
问题描述
我正在尝试检测单击jQueryui选项卡组件上的新选项卡的时间。我已经关注了几个指南和博客,但无法围绕这个过程。我有以下内容:
I am trying to detect when a new tab on my jQueryui tab component is clicked. I have followed several guides and blogs, but can't wrap my head around the process. I have the following:
$('#tabs').tabs({
select: function(event,ui) {
alert('selected');
return false;
},
});
我不知道我错过了什么,但警报从未触发。我对jQuery的态度不强,所以我可能犯了一个愚蠢的错误,所以任何帮助都会受到赞赏。
I don't know what I'm missing, but the alert never fires. I'm am not strong with jQuery so I'm probably making a stupid mistake, so any help will be appreciated.
谢谢,
Kris
Thanks, Kris
更新:jsfiddle示例 http://jsfiddle.net/T7czp/ 16 /
Update: jsfiddle example http://jsfiddle.net/T7czp/16/
推荐答案
您是否收到任何错误? 选择
之后的尾随,
将在某些浏览器中破坏脚本。
Are you getting any errors? The trailing ,
after your select
will break the script in some browsers.
这就像在这个小提琴中看到的那样: http://jsfiddle.net/T7czp/15/
This works as seen in this fiddle: http://jsfiddle.net/T7czp/15/
$('#tabs').tabs({
select: function(event,ui) {
alert('selected: '+ui.index);
}
});
这篇关于检测选项卡在jQueryUI下被选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!