是否有任何选项可以在模糊后将焦点重新集中在同一元素上(基于某些计算)。 这是我的 jQuery:-
$("input[type='text'],textarea").blur(function (e) {
//code
$(this).focus();
});
最佳答案
是的。使用setTimeout()。请注意,如果您执行不当,您可能会阻止用户在表单中移动,并且如果下一个字段也是文本或文本区域,您将启动循环
$("input[type='text'],textarea").blur(function (e) {
var id = this.id; // or save $(this) in a var
setTimeout(function() { $("#"+id).focus();}, 100);
});
关于jquery - 模糊后是否有任何选项可以将焦点重新集中在同一元素上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37407906/