如何知道是否在jQuery选项卡上启用了选项卡? [英] How to know if a tab is enabled on jQuery tabs?

查看:166
本文介绍了如何知道是否在jQuery选项卡上启用了选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jQuery UI选项卡的API中找不到( http://docs.jquery. com/UI/Tabs )一种知道是否启用了某个选项卡的方法,我需要这样做,因为在我的应用程序中,我只想在禁用该选项卡的情况下才启用该选项卡.

I can't find in the API of jQuery UI Tabs ( http://docs.jquery.com/UI/Tabs) a method to know if a certain tab is enabled or not, I need that because in an event of my application I want to enable a certain tab only if that tab is disabled.

您知道如何从jquery api中获取该信息吗?

Do you know how can I get that information from the jquery api?

谢谢.

推荐答案

disabled选项返回已禁用选项卡的索引,因此用于检查是否已禁用的功能如下所示:

The disabled option returns an aray of he indexes of the disabled tabs, so a function to check if one's disabled would look like this:

function isDisabled(index) {
  return $.inArray(index, $("#tabs").tabs("option", "disabled")) > -1;
}

您可以在这里尝试,它仅使用

You can give it a try here, this just uses $.inArray() to see if the index is present, just remember the index is 0 based, so the 1st tab is 0, 2nd one is 1, etc.

这篇关于如何知道是否在jQuery选项卡上启用了选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆