[jQuery] Refactoring Tabs
- by Nimbuz
$('#mode li:first').addClass('active');
$('#mode li.active').append('<span class="arrow"> </span>');
$('#mode li a').click(function () {
$('#mode li').removeClass('active')
$('.arrow').remove();
$(this).parent().addClass('active').append('<span class="arrow"> </span>');
var a = $(this).attr('href');
$('.tab-content').hide();
$(a).show();
return false;
});
.. works, but looking ugly. Can it be simplified/reduced further?
Many thanks!