// cf7 form error validation jQuery('.wpcf7-submit').on('click', function(){ setTimeout(function(){ jQuery('.wpcf7-validation-errors').fadeOut(); jQuery('div.wpcf7-mail-sent-ok').fadeOut(); },5000); }); var req_field = jQuery('input.wpcf7-validates-as-required'); jQuery( req_field ).each(function( index ) { jQuery(this).attr('aria-default', ''); jQuery(this).attr('aria-default', jQuery(this).attr('placeholder')); }); jQuery('.wpcf7-submit').on('click', function(){ var this_form = jQuery(this).parents('form:first').parent().attr('id'); jQuery('#'+this_form + ' ' + ' form .wpcf7-form-control').css('border-color', '1px solid #A99E9E'); jQuery('select.wpcf7-validates-as-required').children(':first').val("") var orig = jQuery('#'+this_form + ' ' + ' form .wpcf7-text.wpcf7-validates-as-required'); jQuery( orig ).each(function( index ) { var orig_placeholder = jQuery(this).attr('name').replace(/\-/g, ' '); if( jQuery(this).attr('name') == 'quiz' ){ jQuery(this).attr('placeholder', ''); } else{ jQuery(this).attr('placeholder', orig_placeholder+'*').addClass('capitalise'); } }); jQuery( document ).ajaxComplete(function( event,request, settings ) { if( jQuery('.sidebar-primary .wpcf7-quiz-label .verify-label').length <= 0 ){ jQuery('.sidebar-primary .wpcf7-quiz-label').html( 'Verify*: ' + jQuery('.sidebar-primary .wpcf7-quiz-label').html() ); } if( jQuery('.form-wrap .wpcf7-quiz-label .verify-label').length <= 0 ){ jQuery('.form-wrap .wpcf7-quiz-label').html( 'Verify*: ' + jQuery('.form-wrap .wpcf7-quiz-label').html() ); } if( jQuery('.content .wpcf7-quiz-label .verify-label').length <= 0 ){ jQuery('.content .wpcf7-quiz-label').html( 'Verify*: ' + jQuery('.content .wpcf7-quiz-label').html() ); } var error = jQuery('#'+this_form + ' ' + ' form .wpcf7-not-valid-tip'); jQuery( error ).each(function( index ) { jQuery('.wpcf7-form-control.wpcf7-quiz').attr('placeholder', ' '); var field_error = jQuery(this).html(); if( field_error.length > 0 ){ if( jQuery(this).prev('.wpcf7-checkbox') ){ jQuery(this).prevAll('#'+this_form + ' ' + ' form .wpcf7-checkbox.wpcf7-validates-as-required').css('border', '2px solid rgb(201, 26, 26)'); } if( jQuery(this).prev('select.wpcf7-validates-as-required') ){ jQuery(this).prevAll('#'+this_form + ' ' + ' form select.wpcf7-validates-as-required').css('border', '2px solid rgb(201, 26, 26)'); } if( jQuery(this).prev().attr('name') == '_wpcf7_quiz_answer_quiz' ){ jQuery(this).prevAll('input.wpcf7-form-control').val(''); jQuery(this).prevAll('input.wpcf7-form-control').attr('placeholder', field_error).css('border', '2px solid rgb(201, 26, 26)'); } else if( jQuery(this).prev('input.wpcf7-form-control') ){ var field_name = jQuery(this).prev('input.wpcf7-validates-as-required').attr('aria-default'); //alert( '#'+this_form ); jQuery(this).prevAll('#'+this_form + ' ' + ' form input.wpcf7-form-control').val(''); //jQuery(this).prevAll('#'+this_form + ' ' + ' form input.wpcf7-form-control').attr('placeholder', field_error + ' - ' + field_name ).css('border', '2px solid rgb(201, 26, 26)'); jQuery(this).prevAll('#'+this_form + ' ' + ' form input.wpcf7-form-control').attr('placeholder', field_error + ' ' + field_name ).css('border', '2px solid rgb(201, 26, 26)'); jQuery(this).prevAll('#'+this_form + ' ' + ' form input.wpcf7-form-control').blur(); } } }); }); jQuery( document ).ajaxSuccess(function( event,request, settings ) { jQuery('.form-wrap input').css('border', '0px!important;'); }); }); // cf7 form error validation ends jQuery('.wpcf7-quiz-label').prepend('Verify*: '); jQuery('.wpcf7-quiz-label').unwrap('label'); jQuery(".wpcr3_div_2 table tr:nth-child(6) td label, .wpcr3_div_2 table tr:nth-child(7) td label").prepend('*'); //* Mobile Feature jQuery('.mobile_feature').bxSlider({ mode: 'fade', captions: true, slideWidth: 380, auto: true, autoControls: true, infiniteLoop: true }); //* Featured Gallery jQuery('.slider1').bxSlider({ slideWidth: 390, minSlides: 4, maxSlides: 20, slideMargin: 0, moveSlides: 1 }); //* Featured Testimonials jQuery('#testimonials .wpcr3_reviews_holder, .sidebar .wpcr3_reviews_holder ').bxSlider({ mode: 'fade', auto: true, autoControls: true, infiniteLoop: true, slideWidth: 1000 }); //* Badges jQuery('.badges').bxSlider({ slideWidth: 1200, minSlides: 5, maxSlides: 20, slideMargin: 10, infiniteLoop: true, auto: true, autoControls: true, moveSlides: 1, autoHover: true }); jQuery(".wpcr3_review_author:contains('by ')").html(function(_, html) { return html.replace(/(by )/g, ''); }); jQuery(".wpcr3_review_author:contains(' on ')").html(function(_, html) { return html.replace(/( on )/g, ''); }); jQuery(".read-more").click(function(){ var link =jQuery(this); jQuery(".toggle-content").fadeToggle( "slow", "linear", function() { if (jQuery(this).is(':visible')) { link.text('Hide'); } else { link.text('Read More'); } }); });