Happy Happy - 6 months ago 20
Javascript Question

jquery tabselect not working when clicking on tab

I am using jquery tabselect plugin. Here is link

When i select tab then it should fire alert. But thats not happening.

I wrote below code

$('#langtabs span.active').each(function(){
alert("d");
var lang=$(this).text();
select_lang+=','+lang;
});


Here is Fiddle

Can someone help me on this please?

Answer

Use onChange event, like this:

$('#langtabs').tabSelect({
        tabElements: languages,
        selectedTabs: [ 'de', 'en' ],  
        onChange: function(selection){
            alert(selection);
        }
    });

check updated fiddle

Comments