I wanted to know the language tab selected while uploading file from the set of dynamic generated tabs. It should also pass the language selected from the highlighted tab i.e 1st one in the snapshot below
Here I have selected Chinese language tab form the 4th set. I have chosen 4rd set from which the file will be uploaded. Now I need to recognize the selected language to pass the value via my ajax call.
I am using the command console.log($("ul.nav-tabs li.active a").text());
which gives result as "ChineseEnglishChineseChinese"
which shows languages active from all the tabs. I need only from the 4th i.e. only "Chinese"
. Please let me know if you know how to do.
Below is the function to add new tabs:
function buildTabsNew() {
var questions = jsonResponse;
var newTabs = [];
var langlength = questions[0].DetailLanguages.length;
console.log(questions[0].DetailLanguages);
for (var k = 0; k < langlength; k++) {
counter++;
languageSelected = questions[0].DetailLanguages[k].Language_Name;
var tabsArray = {
paneId: "paneid-" + counter,
title: questions[0].DetailLanguages[k].Language_Name,
content: '<textarea class="textarea-' + hash + k + '" placeholder="' + questions[0].DetailLanguages[k].Language_Name + '" style="width: 100%; height: 200px; font-size: 14px; line-height: 18px;"></textarea><div id="uploadFile-' + hash + k + '"></div>',
active: k == 0 ? true : false,
disabled: false
};
newTabs.push(tabsArray);
console.log(newTabs);
}