//jQuery.noConflict(); (function ($) { $(function () { $('.error').hide(); $('input.text-input').css({backgroundColor: "#FFFFFF"}); $('input.text-input').focus(function () { $(this).css({backgroundColor: "#FFDDAA"}); }); $('input.text-input').blur(function () { $(this).css({backgroundColor: "#FFFFFF"}); }); $(".wpcf7-submit").click(function () { // validate and process form // first hide any error messages $('.error').hide(); var yourname = $("input#yourname").val(); if (yourname == "") { $("label#yourname_error").show(); $("input#yourname").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("label#email_error").show(); $("input#email").focus(); return false; } var phone = $("input#phone").val(); if (phone == "") { $("label#phone_error").show(); $("input#phone").focus(); return false; } var website = $("input#website").val(); var content = $("textarea#content").val(); if (content == "") { $("label#content_error").show(); $("textarea#content").focus(); return false; } var recaptcha = $("#g-recaptcha-response").val(); if (recaptcha == "") { alert('Recaptcha validation fail.') return false; } if ($('#gdpr').is(':checked')) { var dataString = 'yourname=' + yourname + '&email=' + email + '&phone=' + phone + '&website=' + website + '&content=' + content + "&g-recaptcha-response=" + recaptcha; //alert (dataString);return false; $.ajax({ type: "POST", url: "bin/process-contact.php", data: dataString, success: function ( response) { if( response === 'error-captcha' ){ $('#contact_form').html("
"); $('#message').html("") .append("") .hide() .fadeIn(1000, function () { $('#message').append("
Recaptcha validation fail.
"); }); return; } $('#contact_form').html("
"); $('#message').html("") .append("") .hide() .fadeIn(1000, function () { $('#message').append("
Dziękujemy! Twoja wiadomość została wysłana!
"); }); } }); return false; } //gdpr }); }); })(jQuery);