Jquery - Select tab via url

后端 未结 4 853
既然无缘
既然无缘 2021-01-15 23:42

I have the following jquery code that allows me to use tabs, to tab back and fourth between content/divs. My question is using the code below, how could I have it load the i

4条回答
  •  天命终不由人
    2021-01-16 00:12

    You can use gup function,found here:

    function gup( name )
    {
      name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
      var regexS = "[\\?&]"+name+"=([^&#]*)";
      var regex = new RegExp( regexS );
      var results = regex.exec( window.location.href );
      if( results == null )
        return "";
      else
        return results[1];
    }
    

    This will allow you to read a URL parameter and use it to navigate to the selected tab.

提交回复
热议问题