Such is the question, how to check some function on jQuery not every click, but every 10 seconds, for example, I have a form of login verification in the registration:

$('#reg_login').keyup(function(){ $('.errorMess').removeClass().empty(); $('#reg_login').css({'border':'#7ea4cc 1px solid'}); if(($('#reg_login').val().length)<4 || ($('#reg_login').val().length)>16){ $('#reg_login').after('<div class=\'errorMess\'>Логин не должен быть меньше 4 и больше 16 символов!</div>'); } else{ $.post('ajax/check_login.php', {login:$('#reg_login').val()},function(data){ if(data == 'yes'){ $('#reg_login').css({'border':'green 2px solid'}); } else{ $('#reg_login').after('<div class=\'errorMess\'>Логин уже занят другим пользователем!</div>'); } }); } }); 

The script is executed every time a key is pressed, and how to make the script checked every second? Thank you in advance.

    2 answers 2

    setInterval ()

    • Thanks, works) - oOKomarOo