jQuery(document).ready(function($) { // Tabs $('.woocommerce-tabs .panel').hide(); $('.woocommerce-tabs ul.tabs li a').click(function(){ var $tab = $(this); var $tabs_wrapper = $tab.closest('.woocommerce-tabs'); $('ul.tabs li', $tabs_wrapper).removeClass('active'); $('div.panel', $tabs_wrapper).hide(); $('div' + $tab.attr('href')).show(); $tab.parent().addClass('active'); return false; }); $('.woocommerce-tabs').each(function() { var hash = window.location.hash; if (hash.toLowerCase().indexOf("comment-") >= 0) { $('ul.tabs li.reviews_tab a', $(this)).click(); } else { $('ul.tabs li:first a', $(this)).click(); } }); // Star ratings for comments $('#rating').hide().before('

12345

'); $('body') .on( 'click', '#respond p.stars a', function(){ var $star = $(this); var $rating = $(this).closest('#respond').find('#rating'); $rating.val( $star.text() ); $star.siblings('a').removeClass('active'); $star.addClass('active'); return false; }) .on( 'click', '#respond #submit', function(){ var $rating = $(this).closest('#respond').find('#rating'); var rating = $rating.val(); if ( $rating.size() > 0 && ! rating && woocommerce_params.review_rating_required == 'yes' ) { alert(woocommerce_params.i18n_required_rating_text); return false; } }); // prevent double form submission $('form.cart').submit(function(){ $(this).find(':submit').attr( 'disabled','disabled' ); }); });