$('#search').on("click",function(){ if ($('#demo-form').valid()) { $('body').removeClass('loaded'); } }); grecaptcha.ready(function() { grecaptcha.execute('6LcL0BEcAAAAAAlbdfrlC2htRexQ7QW1UEKKTiz_', {action: 'contact'}).then(function(token) { if (token) { document.getElementById('recaptcha').value = token; } }); }); $('#demo-form').on('keyup blur', 'input', function(event) { $('#demo-form').validate({ rules: { email: { email:true, }, customer_number: { required: true, }, invoice_number: { required: true, }, }, messages: { email: 'Please enter valid email', customer_number: 'Please enter customer number', invoice_number: 'Please enter invoice number', }, errorElement: 'span', errorPlacement: function (error, element) { error.addClass('invalid-feedback'); element.closest('.input-group').append(error); }, highlight: function (element, errorClass, validClass) { $(element).addClass('is-invalid'); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass('is-invalid'); }, }); }); $(document).ready(function () { setTimeout(function() { $(".alert").alert('close'); }, 10000); });