Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > TabStrip > Find Tab Before Adding

Not answered Find Tab Before Adding

Feed from this thread
  • Posted on Nov 30, 2011 (permalink)

    Hi
    I am adding tabs client-side. However, i do not want to create duplicate tabs.
    Is there a simple way of detecting if a tab already exists in the tabstrip ?

    I have tried to iterate through each tab, but can not figure out how to get text of tab... (see code below)
    var textValue;
    var index;
    var exists = false;
    $('#SampleTabStrip a').each(function () {
       textValue= $.data(this, 'tTabStrip');
       if (textValue== newTextValue) { exists = true; index = $(this).attr('text'); }
    })
    I pass newTextValue into function but my attributes dont seem to be correct for the matching process...

    Any ideas please?

    Thanks
    Mark

    Reply

  • Atanas Korchev Atanas Korchev admin's avatar

    Posted on Dec 2, 2011 (permalink)

    Hi Mark,

     This 
    textValue= $.data(this'tTabStrip');

    will not get the text of the tab. You need to use the text() jQuery method to get the text content of a html element. Please change your code to this:

    $('#SampleTabStrip a').each(function () {
       textValue= $(this).text();
       // ...
    }

    Kind regards,

    Atanas Korchev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

  • Posted on Dec 2, 2011 (permalink)

    Yes !!
    That worked...many Thanks

    Mark

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > TabStrip > Find Tab Before Adding
Related resources for "Find Tab Before Adding"

ASP.NET MVC TabStrip Features  |  Documentation  |  Demos  |  Telerik TV ]