I'm using Loopj Tokeninput plugin and I would like to know if anyone has implemented the jQuery "combobox" functionality in it? or something similar? The scope is to allow for displaying all the data from a local source by clicking an "arrow down" or just by clicking in the input field just like a dropdown menu (but allowing to narrow it down when typing something...). If so, could anyone share how to implement it?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
Chosen
is exactly what you need.Hey there is no method predefined to do that in tokeninput plugin.. However we can alter the plugin itself to achieve what you need. I did some alter to plugin .Do the same change in your jquery.tokenput.js file and see if it works. Open the js file.Search for
Now goto .focus(function(){}) part of it and and replace it with this.
Search for function run_search(query). go to else if part of the function and replace it with below one.
We are using onfocus of that input box to return the whole list when the box is in focus and query is empty.if query is not empty then it will search for that query.
Additionally, if you wants to show a scrollbar in the search results box, you should modify the css of "div.token-input-dropdown" in the token-input.css file as follows: - Eliminate or Comment: "overflow: hidden;" - Add: "max-height: 150px;" (or whatever max height you want the box to have) - Add: "overflow: auto;"