How To add a placeholder to jQuery Tokeninput?

匿名 (未验证) 提交于 2019-12-03 08:54:24

问题:

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



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!