Kendo UI TabStrip - tab selection by text Text

I am trying to select a tab in javascript when I only know the Text in the tab

I know to get the selected tab, I do this:

var tabStrip = $("#tabMain").data("kendoTabStrip"); var tab = tabStrip.select(); 

How to make the selected tab be the same with the text "MyTitle"

Note. I am creating a tab with MVC 4

  @(Html.Kendo().TabStrip() .Name("tabMain") .Items(items => { items.Add().Text("MyTitle") 
+4
source share
4 answers

Basically you need to find the li.k element and pass it to the selection method. Here goes jQuery:

 var ts = $('#tabstrip').data().kendoTabStrip; var item = ts.tabGroup.find(':contains("What you look for")'); ts.select(item); 
+9
source
 $(document).ready(function(){ $j("#tabstrip").kendoTabStrip( { animation: { open: { effects: "fadein" } }, select: function(element){selecttab(element)} }); function selecttab(element) { var tabStrip1 = $('#tabstrip').kendoTabStrip().data("kendoTabStrip"); tabStrip1.select("li:contains(" + $(element.item).text()+ ")"); } 
+2
source

I tried this - just jQuery seems to be working in chrome now ...

var selectedTabName = $ ("li [aria-selected = 'true']"). text ();

+1
source

Kendo MVC Server Wrapper provides the .SelectedIndex (0) method at the tab bar level and the Selected () method at the individual tab level:

tabstrip.Add (). Text ("My Tab") . Selected (someValue = "My Tab")

0
source

All Articles