In this
post I’ll show how to set the tab index to Telerik tabstrip or get the selected
tab index using client scripting i.e. JQuery.
Set the
tab index: Create
one function in your JQuery plugin or page, and call this function on either OnLoad of tabstrip or anywhere else you
want to set the tab index.
function SetTabStrip() {
//Get the tab strip.
var tabStrip = $("#TabStrip").data("tTabStrip");
//Set the tab index on which tab you want to navigate.
var index = 0;
//Get the DOM element using Index
var domElement = $("li",
tabStrip.element)[index];
//Finally select that DOM element.
tabStrip.select(domElement);
}
|
Get the
tab index: Same
way you can create one function to get selected index method using below code (or
you can find tab index in existing method if you want).
function
GetTabStripIndex() {
// Find selected tab and then get index.
var selectedIndex = $("#TabStrip > ul").find(".t-item.t-state-active").index();
return selectedIndex;
}
|
Comments
Post a Comment