Bootstrap tab activation with JQuery

后端 未结 7 1250
花落未央
花落未央 2020-12-13 03:15

I have the following code

  • AAA
  • &
7条回答
  •  被撕碎了的回忆
    2020-12-13 03:58

    This one is quite straightforward from w3schools: https://www.w3schools.com/bootstrap/bootstrap_ref_js_tab.asp

    // Select tab by name
    $('.nav-tabs a[href="#home"]').tab('show')
    
    // Select first tab
    $('.nav-tabs a:first').tab('show') 
    
    // Select last tab
    $('.nav-tabs a:last').tab('show') 
    
    // Select fourth tab (zero-based)
    $('.nav-tabs li:eq(3) a').tab('show')
    

提交回复
热议问题