jQuery UI tabs. How to select a tab based on its id not based on index

前端 未结 14 2215
刺人心
刺人心 2020-12-25 11:07

I have two tabs and configured usign jQuery UI.

ul  class=\"tabs\"
  li  tabone
  li tabtwo
ul

dynamically from C# code behind I will hide

14条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-25 11:36

    I found this works more easily than getting an index. For my needs, I am selecting a tab based off a url hash

    var target = window.location.hash.replace(/#/,'#tab-');
    if (target) { 
        jQuery('a[href='+target+']').click().parent().trigger('keydown');      
    }   
    

提交回复
热议问题