سؤال

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

هل كانت مفيدة؟

المحلول 2

I think the current version of tokenInput supports this:

$(function() {
  $("#elementID").tokenInput("http://www.foo.com/bar", {
  placeholder: 'Place holder text...'
});

نصائح أخرى

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top