0

I'm using jQuery with tokeninput Plugin.

I initialize it with:

$("input#id").tokenInput(url, { defaultValue: "Very Long string 1234567810", ...});

After page loading the input box has the value "Very Long string 123". After focus and blur the box, the value becomes "Very Long string 1234567810".

Anyone know how I can fix it?

take
  • 2,202
  • 2
  • 19
  • 36

2 Answers2

1

The answer here did not solve the problem for me. I ended up creating new settings field 'resizeInput' with default value true.

You can get the modified plugin on my github

Use it like this:

$("#my_input_id").tokenInput("/my_url.json",{ resizeInput: false});
Simon Polak
  • 1,959
  • 1
  • 13
  • 21
-1

I've found the solution for my self:

After initializing the tokenInput, there are no style-width attribute of the generated input element.

After adding a css width attribute, all text is shown.

$("#myid").tokenInput (url, options);
$("#token-input-myid").css({"width": "200px"});
take
  • 2,202
  • 2
  • 19
  • 36
  • This won't work: Once you start typing, an annoying internal "feature" called resize_input() kicks in and changes input size back to {entered text len} + 30. Look at blushrt's answer – G. Stoynev Sep 10 '13 at 16:46