Get Selected Tab Item From EJTab

Hi Team,


        I am having a syncfusion tab control ejtab. Currently how to get selected or active tab item from Component File.
     
          Source Code
-- initialized 
$("#defaultTab").ejTab({
            width: "100%"
});
-- end 
-- how to get selected tab  item from ejtab
var tabobj = $("#defaultTab").data("ejTab");
-- end

Kindly check on this and update me asap.

Thanks,
j.bharathkumar 


1 Reply

KV Karthikeyan Viswanathan Syncfusion Team July 12, 2018 05:43 AM UTC

Hi Bharath kumar, 
 
Thanks for contacting Syncfusion support. 
 
 You can get a selected header from items property and get a content panel from contentPanels property. 
 
Please refer the below code example: 

<code> 
document.getElementById("btn").onclick = function (args) { 
  var tabobj = $("#defaultTab").data("ejTab"); 
  console.log("Tab Selected header is "); 
  console.log(tabobj.items[tabobj.model.selectedItemIndex]); 
  console.log("Tab Selected Content is "); 
  console.log(tabobj.contentPanels[tabobj.model.selectedItemIndex]); 
}; 


</code> 


Regards, 
Karthikeyan V. 


Loader.
Up arrow icon