나중에 참조하기 위해 typeWatch 플러그인 (http://archive.plugins.jquery.com/project/TypeWatch)과 함께이 작업을 수행 할 수 있음을 발견했습니다.
기본적 싶은 것은 (슬러그 내 경우)입니다 :
/*Disable keyup validation on focus and restore it to onkeyup validation mode on blur*/
$("form input[data-val-remote-url]").on({
focus: function() {
$(this).closest('form').validate().settings.onkeyup = false;
},
blur: function() {
$(this).closest('form').validate().settings.onkeyup = $.validator.defaults.onkeyup;
}
});
$(function() {
/*Setup the typeWatch for the element/s that's using remote validation*/
$("#Slug").typeWatch({ wait: 300, callback: validateSlug, captureLength: 5 });
});
function validateSlug() {
/*Manually force revalidation of the element (forces the remote validation to happen) */
var slug = $("#Slug");
slug.closest('form').validate().element(slug);
}
당신은 바닐라 typeWatch 플러그인을 사용하는 경우, 당신은 때문에 모든 요소에 대한 설정에 typeWatch을해야합니다 typeWatch 콜백은 $ (this)를 통해 현재 요소에 대한 액세스를 제공하지 않으며 값만 전달합니다.
또는 요소 (timer.el)에서 전달하도록 typeWatch 플러그인을 수정 한 다음 모든 사용자에게 지연을 적용 할 수 있습니다.
내 .js의 $ (document) .ready() 부분에 추가했으며 모든 키를 누른 후에도 유효성을 검사합니다. –