jQuery(document).ready(function($) { //Init Tabs var firstSectionTab = $('#ats-admin .ats-settings-section-wrapper>h2:first-of-type'); firstSectionTab.addClass('current'); var firstSwapTitle = firstSectionTab.next().html(); var firstSwapTable = firstSectionTab.next().next(); var firstSwapTableHTML = firstSwapTable.html().replace('',''); var firstNewHTML = '' + firstSwapTitle + '' + firstSwapTableHTML; $('#ats-current-section').html(firstNewHTML); //Clear Cache Trigger $('body').on('click', 'input.clear-cache', function() { $('form#slideshow-settings #submit').trigger('click'); }); //Tab Actions $('#ats-admin .ats-settings-section-wrapper>h2').each(function() { $(this).on('click',function() { $('#ats-admin .ats-settings-section-wrapper>h2').removeClass('current'); $(this).addClass('current'); var swapTitle = $(this).next().html(); var swapTable = $(this).next().next(); var swapTableHTML = swapTable.html().replace('',''); var newHTML = '' + swapTitle + '' + swapTableHTML; $('#ats-current-section').html(newHTML); }); }); });