I have the following code I want to edit:
$('.tab').click(function() {
$(this).addClass('active').siblings().removeClass('active');
});
Instead of using $(this)
, why can't I do the following:
$('.tab').click(function() {
$('.tab').click(function().addClass('active').siblings().removeClass('active');
});
If that is never going to work, how can I recreate the initial code without having to use $(this)
?