How can I add a placeholder to a jQuery Tokeninput field? A normal placeholder
attribute won't work in here.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I think the current version of tokenInput
supports this:
$(function() { $("#elementID").tokenInput("http://www.foo.com/bar", { placeholder: 'Place holder text...' });
回答2:
For a input like:
<input type="text" id="myInput" />
You can do:
$("#myInput").tokenInput("/scripts/myjson.js"); $("#token-input-myInput").attr("placeholder", "Type here");
When you use tokenInput, it changes your input's id to "token-input-XXX", where XXX is the previous id