【发布时间】:2010-01-21 02:36:56
【问题描述】:
带有焦点的下拉菜单并按下输入键验证表单。
我有一个表单,其中包含由 jquery 验证的元素(在下面的验证器函数中) 如果我有一个文本框,并且启用焦点并按下回车键,我将获得所有 Javascript 验证。
$( document ).ready(function() {
var container = $('div.errors');
$("mydropdownId").focus(); //tried this , focus works, but enter key press check doesn't work
// validate the form when it is submitted
var validator = $("#coverageForm").validate({
invalidHandler: function() {
$('#form_error_notice').css('display', 'block');
$('.server_error_notice').css('display', 'none');
$('.errorsServer').css('display', 'none');
hintAgain();
},
submitHandler: function(){
DoDisable(); //changes couple of divs and does document.form.submit();
},
errorContainer: $("#coverageForm .errors"),
errorLabelContainer: $("ul", "#coverageForm .errors"),
wrapper: 'li',
meta: "validate"
});
// Control input in numeric form fields
$('input.numeric').numeric();
// Initiate overlays
$('.boxy').boxy({modal: true});
});
我是 jquery 的新手,谁能引导我走向光明?我不想更改 jquery 提供的验证。这是我的“客户”的严格要求!
提前致谢!
【问题讨论】:
标签: javascript jquery drop-down-menu