$(document).ready(function() { $('.tab_content_detail').hide(); $('ul#tabs_detail li:first').addClass('active').show(); $('.tab_content_detail:first').show(); $('ul#tabs_detail li').click(function() { $('ul#tabs_detail li').removeClass('active'); $(this).addClass('active'); $('.tab_content_detail').hide(); var activeTab = $(this).find('a').attr('href'); $(activeTab).fadeIn(); return false; }); });