Jquery multiSelect multi-select drop-down box code

Source: Internet
Author: User

Jquery multiselect multi-select drop-down box code

$ "). Multiple options (oneormoreselected: '*', select ALL: false, noneselected: 'default display '));
Usage: $ ('# id '). Multiple choice (option, callback)
Option: Select All-show all options; true/false; default value: True
Selectalltext-text display select/deselect all options at the same time
Noneselected-the text to be displayed is not selected in the list
Oneormoreselected-text display when one or more projects are selected in the list
(Note: You can use a selected number of projects placeholder % ).
Use * to display all selected comma-separated lists. The default value is '% select'
Optgroups tutorial electable-whether optgroups is optional, if you use them, true/false, default = false
Listheight-this is the maximum height selected by droptdown

 

Use webpage special effects to set the default items in the Multi-choice box.


$ ("# Id"). attr ("value", ""); // clear the selected item.
Var ids = '1, 3, 6 '; // you can specify the id of the selected box.
Var id_ojbect = (ids). split (","); // split it into an ojbect array.
Var count = $ ("# id option"). length; // obtain the length of the drop-down box.
For (var c = 0; c <id_ojbect.length; c ++ ){
For (var c_ I = 0; c_ I <count; c_ I ++)
{
If ($ ("# id"). get (0). options [c_ I]. text = id_ojbect [c])
{
$ ("# Id"). get (0). options [c_ I]. selected = true; // set it to selected.
}
}
}


// Update the textbox with the total number of selected items, and determine select all
$ ("# Id"). updateselected ()
// Update the dropdown options
$ ("# Id"). multiselectoptionsupdate ()
// Hide the dropdown
$ ("# Id"). multiselectoptionshide ()
// Show the dropdown
$ ("# Id"). multiselectoptionsshow ()
// Get a coma-delimited list of selected values
$ ("# Id"). selectedvaluesstring

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.