jquery Mutilselect is automatically prompted by default only based on the option set
function (key, value) { $ (' #channels ') . Append ($ ("<option></option>") . attr ("Value", value) // by default by the value of text in the move prompt } );
Read the following requirements:
There are a few options:
Beijing
Tianjin
Hubei
When inputting Chinese, the control can automatically prompt according to input Chinese, such as input "north" hint Beijing, but if want to enter "bei" Prompt "Beijing". The control cannot complete this function, this time need to modify the source code, In the Jquery.multiselect.filter.js file, there is a function updatecache that is specifically prompted to find the definition of this function
Updatecache:function() { //Each list item This. rows = This. Instance.menu.find (". Ui-multiselect-checkboxes li:not (. Ui-multiselect-optgroup-label)"); //Cache This. cache = This. Element.children (). Map (function() { varElem = $ ( This); //Account for optgroups if( This. tagname.tolowercase () = = = "Optgroup") {Elem=Elem.children (); } returnElem.map (function() { return This. Innerhtml.tolowercase (); }). get (); }). get (); //The following section of code is custom, adding phonetic hints feature if( This. cache.length>0){ for(vari=0;i< This. cache.length;i++){ varTV = This. Cache[i]; varletter=tv+CITYMAP[TV]; if(letter!=undefined) { This. cache[i]=tv+Letter ; } } } },
The code above is the new code. The new code is just a few lines. As follows
// The following section of code is custom, adding phonetic hints feature if (this. cache.length>0) { for (var. cache.length;i++) { var This . Cache[i]; var letter=tv+Citymap[tv]; if (letter!=undefined) { this. cache[i]=tv+ letter; }}
Explain this code:
This.rows represents an optional item for each line
This.cache is an array that initializes all option text to this array by default, and after the user enters the character, it iterates through the array, matching the regular expression, and the elements on the match are automatically displayed on the front end.
Full Source code Download:
Link: http://pan.baidu.com/s/1c0AdgI0 Password: 6lck