Kendo UI TabStrip - Selecting a tab by it's Text

Ian Vink picture Ian Vink · Mar 28, 2013 · Viewed 14k times · Source

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

I know to get the Selected Tab I do this:

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

How do I cause the Selected Tab to be the one with the text "MyTitle"

Note: I create the Tab with MVC 4

    @(Html.Kendo().TabStrip()
          .Name("tabMain")
          .Items(items =>
              {
                  items.Add().Text("MyTitle")

Answer

Petur Subev picture Petur Subev · Mar 28, 2013

Basically you need to find the li.k-item and pass it to the select method. Here comes the jQuery:

var ts = $('#tabstrip').data().kendoTabStrip;
var item = ts.tabGroup.find(':contains("What you look for")');
ts.select(item);