Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var settings = {
- 'createCallback':false,
- 'createText':false,
- 'singleSelect':false,
- 'selectedFirst':false,
- 'sort':true,
- 'title':this.attr('title'),
- 'checked':[],
- 'labels':[],
- 'oncheck':false,
- 'onuncheck':false,
- 'minWidth': 'default;',
- };
- $(this).attr('data-msid', multiSelectId);
- $.extend(settings,options);
- $.each(this.children(),function(i,option) {
- // If the option is selected, but not in the checked array, add it.
- if($(option).attr('selected') && settings.checked.indexOf($(option).val()) === -1) {
- settings.checked.push($(option).val());
- settings.labels.push($(option).text().trim());
- }
- // If the option is in the checked array but not selected, select it.
- else if(settings.checked.indexOf($(option).val()) !== -1 && !$(option).attr('selected')) {
- $(option).attr('selected', 'selected');
- settings.labels.push($(option).text().trim());
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement