Question

Hey, sorry to be such a nuisance, but I have another jQuery problem. Same code.

$('.tab').click(function() {
        $(this).unbind("click");

        var classy = $(this).attr("class").split(" ").splice(-1);
        var ihtml = $('.content.'+classy).text();
        $('#holder').html(ihtml).slideDown("slow");

        $('.tab:not(.active)').live('click', function () { 
                $('.tab').removeClass('active');
                $(this).addClass('active');
        });

});

Basically, the problem is, when I click on the tabs, the html content will update, but after I've pressed it once, it won't update, and the content remains the same as the previous tab. Any ideas?

Was it helpful?

Solution

The code you have removes the click handler event from the clicked tab. So it will fire the first time it is clicked but not any other times.

Remove this line:

$(this).unbind("click");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top