How can I change a TAB selected tab from a JavaScript function running on the client side

Hi,

I want to change the selected tab by clicking on a button outside aTab control. I have tried all code I have found in the documentation, nothing work.
Can you provide a code sample?

Thanks a lot,
Laurent

3 Replies 1 reply marked as answer

NR Nevitha Ravi Syncfusion Team January 28, 2021 10:17 AM UTC

Hi Laurent, 

Greetings from Syncfusion Support. 

You can use select public method by passing the index of the tab item to select the tab when clicking on the button. Please refer to the following sample and code. 

<script type="text/javascript"> 
    document.getElementById('btn1').onclick = function () { 
        var tabObj = document.getElementById('ej2Tab').ej2_instances[0]; 
        tabObj.select(1); 
    }; 
</script> 

Please try the above sample and get back to us if you need any further assistance. 

Regards, 
Nevitha 


Marked as answer

LA Laurent January 28, 2021 12:03 PM UTC

Thanks!


VM Vengatesh Maniraj Syncfusion Team January 29, 2021 07:33 AM UTC

Hi Laurent, 

You are most welcome.😊 

Please get in touch with us if you need any further assistance. 

Regards, 
Vengatesh  


Loader.
Up arrow icon