jkhamler
jkhamler

Reputation: 593

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

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 = `***`;
                }
            }

        }
    );

Upvotes: 1

Views: 511

Answers (1)

Rory McCrossan
Rory McCrossan

Reputation: 337713

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 = `***`;
    }
  }
});

Upvotes: 1

Related Questions