jQuery(document).ready(function($) { $('#contact-form').one('click', 'input[type="text"],textarea', function() { date1 = new Date(); }); $('input[name="contactForm"]').click(function() { if (typeof date1 !== 'undefined') { var msec = new Date() - date1; if ( msec > 3000 ) { $('input[name="validator"]').val('ok'); } } }); });