How to set options on jQuery UI Multiselect (Eric Hynds)

425 views Asked by At

https://github.com/ehynds/jquery-ui-multiselect-widget/wiki/Methods

This is driving me crazy. All of the options are listed but not the way to set them!

I have tried everything I can think of, passing in values in the constructor, trying to call methods to set the options, nothing works.

Help greatly appreciated.

    const $venueSelect = $("#venueSelect").multiselect(
        {
            options: {
                noneSelectedText: 'MY CUSTOM TEXT' // (DOES NOT WORK)
            },
            close: function (event, ui) {
                var venueIds = $('#venueSelect').val();

                if (venueIds == '') {
                    window.location = '***';
                } else {
                    window.location = `***`;
                }
            }

        }
    );
1

There are 1 answers

2
Rory McCrossan On

Given the example in the link from the documentation the noneSelectedText property should be in the root of the options object you provide to the plugin instantiation. Try this:

const $venueSelect = $("#venueSelect").multiselect({
  noneSelectedText: 'MY CUSTOM TEXT',
  close: function(event, ui) {
    var venueIds = $('#venueSelect').val();
    if (venueIds == '') {
      window.location = '***';
    } else {
      window.location = `***`;
    }
  }
});