jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Jquery按索引选择元素大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
有我的标记

<UL style="-moz-border-radius-bottomleft: 0; -moz-border-radius-bottomright: 0" class="ui-tabs ui-tabs-nav ui-Helper-reset ui-Helper-clearfix ui-widget-header ui-corner-all" sizcache="3" sizset="5">
  <LI class="ui-state-default ui-corner-top" jQuery1280326216622="3" sizcache="3" sizset="5">
    <A href="#tab_1" jQuery1280326216622="4"><SPAN>Page 1n</SPAN></A>
  </LI>
  <LI class="ui-state-default ui-corner-top ui-tabs-SELEcted ui-state-active" jQuery1280326216622="5" sizcache="3" sizset="6">
    <A href="#tab_2" jQuery1280326216622="6"><SPAN>Page 2</SPAN></A>
  </LI>
  <LI class="ui-state-default ui-corner-top" jQuery1280326216622="7" sizcache="3" sizset="7">
    <A href="#tab_3" jQuery1280326216622="8"><SPAN>Page 3</SPAN></A>
  </LI>
  <LI class="ui-state-default ui-corner-top" jQuery1280326216622="9" sizcache="3" sizset="8">
    <A href="#tab_4" jQuery1280326216622="10"><SPAN>Page 4</SPAN></A>
  </LI>
</UL>

和js代码

jQuery(document).ready(function() {

        jQuery(".ui-layout-center").tabs({   show: loadIframe });

        rootLayout = jQuery('#container').layout
       ({
           applyDefaultStyles: true,north__spacing_open: 0
       });

        jQuery("#tabs_div").tabs();
        loadIframe();
    });
function reciveDataFromPages(tabIndex,data) {
       //do some thing
}

我怎样才能激活标签
index:tabIndex

网址:数据

有任何想法吗???

@H_696_22@解决方法
使用:eq(),例如:

$(".ui-tabs a").removeClass("active");
$(".ui-tabs a:eq("+tabIndex+")").addClass("active");

http://api.jquery.com/eq-selector/

大佬总结

以上是大佬教程为你收集整理的Jquery按索引选择元素全部内容,希望文章能够帮你解决Jquery按索引选择元素所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。