blur 事件是否足以验证 focus out、tab out 等?
Is blur event sufficient to validate focus out, tab out etc.?
我正在使用 jquery 验证插件来验证我的表单。目前我正在验证提交的表格。这意味着当我提交表单时将显示任何验证错误。现在,当我失去对元素的关注时,我想验证表单中的每个元素。这样:
$('#txtFirstName').bind('blur', function(){
$(this).valid();
});
我的问题是:仅在模糊事件上验证每个元素是否足够?这会涵盖元素的任何其他类型的焦点丢失(如果存在的话!)?欢迎提出建议!
The blur
event is sent to an element when it loses focus. [...] An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.
所以没有其他方法可以导致元素失去焦点,我认为 blur()
无法处理(这是 .on('blur', handler)
的 shorthand) .
AFAIK,你可以使用这个事件处理程序。
我正在使用 jquery 验证插件来验证我的表单。目前我正在验证提交的表格。这意味着当我提交表单时将显示任何验证错误。现在,当我失去对元素的关注时,我想验证表单中的每个元素。这样:
$('#txtFirstName').bind('blur', function(){
$(this).valid();
});
我的问题是:仅在模糊事件上验证每个元素是否足够?这会涵盖元素的任何其他类型的焦点丢失(如果存在的话!)?欢迎提出建议!
The
blur
event is sent to an element when it loses focus. [...] An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.
所以没有其他方法可以导致元素失去焦点,我认为 blur()
无法处理(这是 .on('blur', handler)
的 shorthand) .
AFAIK,你可以使用这个事件处理程序。