UPDATE: Much easier using JQuery
I am creating Tabs dynamically and need to access the tab later to test if it already exists and add/change content.
I have a function to do this but it only works in IE and not firefox. There must be a better more JQuery way of doing it.
I have tried adding an ID field to the Tab when I create them and then using a selector but this dd not work. Any suggestions?
var
tabQuery = $(
'#workTabs .k-tabstrip-items .k-item .k-link'
).filter(
function
() {
return
$(
this
).text() == tabName;
});
I am creating Tabs dynamically and need to access the tab later to test if it already exists and add/change content.
I have a function to do this but it only works in IE and not firefox. There must be a better more JQuery way of doing it.
I have tried adding an ID field to the Tab when I create them and then using a selector but this dd not work. Any suggestions?
function
findTab(tabs, tabName) {
var
i = 0;
var
foundTab;
while
(
true
) {
var
next = tabs.tabGroup.children(
"li"
).eq(i);
if
(next && next.length > 0) {
var
tabText = next[0].innerText;
if
(tabText == tabName) {
// found
foundTab = next;
break
;
}
}
if
(!next || (next.length == 0)) {
break
;
}
i++;
}
return
foundTab;
}