jquery ui - How to get TabIndex for the current selected tab? -
All,
I have done the JQuery UI tab I have a reload tab functionality for the nested tabs I want to apply Currently the following code has static pieces for the nested tabs, but eventually they will have URLs, so tabs can behave as Ajax tabs. How can I get reloadab functionality?
& lt; Html & gt; & Lt; Top & gt; & Lt; Link type = "text / css" rel = "stylesheet" href = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css" / & Gt; & Lt; Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt; Script src = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Function () {$ ('# tabContainer'). Tab ({selected: 0}); $ ('# piece-1'). Tab ({selected: 1});}); Function ReloadTab (Tablindex) {var smalltabs = $ ('# fragment-1'). Tab ({cache: wrong spinner: '', selected: 0}); $ ('# TabContainer') Tab ('Load', Small Tots Tabs ('Options', 'Selected')); $ ('# Piece-1'). Tab ('load', tabinedx); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "tabContainer" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "# piece-1" & gt; & Lt; Span & gt; TAB1 & lt; / Span & gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# Piece-2" & gt; & Lt; Span & gt; TAB2 & lt; / Span & gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# piece -3" & gt; & Lt; Span & gt; TAB3 & lt; / Span & gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "section-1" & gt; & Lt; Ul class = "innerNav" & gt; & Lt; Li & gt; & Lt; A href = "# Piece-1A" & gt; & Lt; Span & gt; INNERTAB1 & lt; / Span & gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# piece-1b" & gt; & Lt; Span & gt; INNERTAB2 & lt; / Span & gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "fragment-1a" class = "internalFragment" & gt; Internal tab 1's content & lt; / Div & gt; & Lt; Div id = "fragment-1b" class = "internalFragment" & gt; Internal tab2 content & lt; Br> & Lt; A href = "javascript: reload tab (1);" & Gt; Reload tab content & lt; / A & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div id = "section-2" & gt; & Lt; / Div & gt; & Lt; Div id = "section-3" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;
thanks
to:
var $ tab = $ ('# example'). Tab (); Var selected = $ tabs.tabs ('option', 'selected'); // = & gt; 0
edit
I copied your file, and made the following changes:
- < Li>
Change the reload link to look like this:
href = "#" id = "reload"
(Markdown converts my anchor tag to a link)
- Change jquery to:
$ (Function () {$ (tab ({select: 0}); $ ('# fragment-1'). Tab ({selected: 0}); $ ('# reload') Click (function () { Var $ tab = $ ('# piece-1'). Tab (); Reload tab ($ tab. Tab ('option', 'selected'));});}) Function reload tab (tabindex) {// Alert (tabindex); // Un-comment for proof Var smalltabs = $ ('# fragment-1 Tab ('cache: wrong spinner:', selected: 0}); $ ('# TabContainer'). Tab ('Load', Small Tots Tabs ('Options',' Selected ')); $ (' # Piece-1 '). Tab (' Load ', Tabindex);}
Comments
Post a Comment