How can I add a placeholder to a jQuery Tokeninput field? A normal placeholder
attribute won't work in here.
Asked
Active
Viewed 3,592 times
4

THpubs
- 7,804
- 16
- 68
- 143
2 Answers
7
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

Buzinas
- 11,597
- 2
- 36
- 58
4
I think the current version of tokenInput
supports this:
$(function() {
$("#elementID").tokenInput("http://www.foo.com/bar", {
placeholder: 'Place holder text...'
});

Shiladitya
- 12,003
- 15
- 25
- 38
-
There is no placeholder setting I found in tokenInput doc – Jigarb1992 Dec 28 '16 at 10:32