Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To add a placeholder to jQuery Tokeninput?

How can I add a placeholder to a jQuery Tokeninput field? A normal placeholder attribute won't work in here.

like image 277
THpubs Avatar asked Dec 20 '22 16:12

THpubs


1 Answers

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

like image 93
Buzinas Avatar answered Dec 24 '22 01:12

Buzinas