jQuery tokenInput插件(和焦点) [英] jQuery tokenInput plugin (and focus)
本文介绍了jQuery tokenInput插件(和焦点)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人使用tokeninput插件并成功将焦点设置在token输入字段上吗?我正在尝试实现此.
Is anyone using tokeninput plugin and successfully setting focus on a token input field? I'm trying to achieve this.
已解决: 万一其他人需要,解决方案:
Solved: In case anyone else needs, the solution:
$(document).ready(function() {
$("#YourTokenInput").tokenInput("http://shell.loopj.com/tokeninput/tvshows.php",
{ theme: "facebook"
}).focus();
});
推荐答案
OP的解决方案不适用于我.不确定是浏览器问题,还是元素加载及时问题,或者是什么问题,但这是我必须要做的(在初始化令牌输入之后:
OP's solution didn't work for me. Not sure if it is a browser issue, or a issue with the elements being loaded in time, or what, but this is what I had to do (after initializing the token input:
setTimeout(function() { $('#token-input-search-input').focus(); }, 50);
注意:(在Chrome中测试)
Note: (testing in Chrome)
这篇关于jQuery tokenInput插件(和焦点)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文