Textual multiselect

by donabrams

JavaScript

(function($) {
    $.widget("textualMultiselect", {
        options: {
            separator = "and";
        },
        _create() {
            var $this = $(this);
            var name = $this.attr("name");
            var options = $this.children("option");
            this.selectedOptions = [];
            this.options = [];
            for (var option in options) {
                var optionData = {
                    val: option.attr("value") ? option.attr("value") : option.text(),
                    text: option.text()
                };
                this.options.push(optionData);
                this.selectedOptions.push(optionData.val);
            }

        },
        _underline: function() {},
        destroy: function() {},
        //option is selected from the multilist (removed from the list and appended to the page)
        select: function() {},
        //option is deselected (removed from the page and appended to the list in the original place)
        deselect: function() {},
        //show the multiselect choices under the line
        display: function() {},
        //hide the multiselect choices
        hide: function() {},
        //function called at decoration that puts a underline down that is selectable and changes color on hover
        underline: function() {}
    };
})(jQuery);