Search code examples
jqueryjquery-uijquery-ui-multiselect

jQuery ui multi select shows comma-separated texts


I have a jQuery.UI multiselect by Eric Hynds this is the link

I want to show the multiple selected texts comma-separated.

Any ideas?


Solution

  • You can use the selectedText option

    $('selector').multiselect({
        selectedText: function (sCount, tCount, els) {
            if (sCount) {
                return $.map(els, function (el) {
                    return $(el).val()
                }).join()
            } else {
                'None'
            }
        }
    })