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'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);
Note: (testing in Chrome)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With