开发者

On focusout, focus

开发者 https://www.devze.com 2023-03-14 10:18 出处:网络
Does jQuery prevent this type of behavior? $(\"input\").focusout(function() { $(this).focus(); });开发者_运维百科

Does jQuery prevent this type of behavior?

$("input").focusout(function() {
    $(this).focus();
});开发者_运维百科


This is how it's done (works cross-browser):

$('input').blur(function() {
    var that = this;
    setTimeout(function() { $(that).focus(); }, 0);
});

Live demo: http://jsfiddle.net/jzt2Z/1/


1) Actually it works in Chrome. Here is an example: http://jsfiddle.net/8WP53/

Once 1st input gets focuseout - it remains focused, and user cannot focus any other input

2) in IE I get an error "Stack overflow" (brand name StackOverflow.com error :) )

3) Strange, but in Firefox you can select any input, but no error is being produced

0

精彩评论

暂无评论...
验证码 换一张
取 消