Microsoft JScript运行时错误:选项卡小部件实例没有这种方法“选择" [英] Microsoft JScript runtime error: no such method 'select' for tabs widget instance

查看:77
本文介绍了Microsoft JScript运行时错误:选项卡小部件实例没有这种方法“选择"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

点击html按钮时,我需要 select 特定于jquery标签的标签功能.我正在使用jquery.1.9.1.jsjquery-ui-1.10.2.custom.js文件.我已经实现了以下代码,但对我不起作用.

I need select specific tab functionality for the jquery tabs on clicking on the html buttons. I am using jquery.1.9.1.js and jquery-ui-1.10.2.custom.js file. I have implemented below code but does not work for me.

<script language="javascript" type="text/javascript">
 $("#ui-tabs").tabs();
 function SelectTab() { // bind click event to link
                 $('#ui-tabs').tabs('select', 2); // switch to third tab
                 return false;
             }
 </script>
<div id="ui-tabs">
<ul>
    <li><a href="#tabs-1">Nunc tincidunt</a></li>
    <li><a href="#tabs-2">Proin dolor</a></li>
    <li><a href="#tabs-3">Aenean lacinia</a></li>
</ul>
<div id="tabs-1">Tab1 content </div>
<div id="tabs-2">Tab2 content </div>
<div id="tabs-3">Tab3 content </div>
</div><a id="next" class="button-style" href="#" onclick="return SelectTab();">Select Tab</a>

问题是函数SelectTab中的语句$('#ui-tabs').tabs('select', 2);给我错误Microsoft JScript runtime error: no such method 'select' for tabs widget instance.正常选择选项卡时,单击它们即可正常工作.但是从函数调用完成后,它不起作用.实施中出了什么问题或缺少任何文件?请提出建议.

The problem is statement $('#ui-tabs').tabs('select', 2); in function SelectTab gives me error Microsoft JScript runtime error: no such method 'select' for tabs widget instance. Normal selection of tabs on clicking on them working fine. But it is not working when done from function call. Whats going wrong in the implementation or is there any file missing? please suggest.

推荐答案

此版本中没有用于jQuery UI Tabs的select方法.为了使您的功能正常工作,您需要将代码更改为;

There is no select method for jQuery UI Tabs in this version. To get your functionality to work you need to change your code to;

$('#ui-tabs').tabs( "option", "active", 2 );

请阅读 http://api.jqueryui.com/tabs/#option-active 以获得更多信息.

Please read http://api.jqueryui.com/tabs/#option-active for more information on this.

// getter
var active = $( ".selector" ).tabs( "option", "active" );

// setter
$( ".selector" ).tabs( "option", "active", 1 );

请查看以下 jsFiddle 的示例,以了解其工作原理.

Check out this little jsFiddle for an example of it working.

这篇关于Microsoft JScript运行时错误:选项卡小部件实例没有这种方法“选择"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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