wenzhixin / multiple-select

A jQuery plugin to select multiple elements with checkboxes :)
http://multiple-select.wenzhixin.net.cn
MIT License
1.91k stars 651 forks source link

Additional options that makes the select usable without a label. #542

Closed mkhatoun closed 4 years ago

mkhatoun commented 4 years ago

Currently this element is only useful if there is a label describing it's content because once a selection is made the placeholder is overwritten. New "options" can be added to allow programmers to change this behavior. Options like: selectAllText, selectNoneText, preSelectText, postSelectText to allow the use of user defined text instead of the defaults, or append before or after the defaults. e.g. selectAllText: 'Employees (all)', preSelectText: 'Employees % ', postSelectText: '% Employees', etc.

I tried to change this through event handlers without success. I could change some css of the span element, but the default event behavior always overwrote my text. Using the event.preventDefaults() at one time did the trick but gave inconsistent results. The code also seems to work better when the element is declared with class name selector rather than an ID selector. I think because the parent button to span is also assigned the class name when the select is created with a class selector.

mkhatoun commented 4 years ago

Please disregard. Found some functionalities through the localization functions.