bootstrap multiselect dropdown leave focus event

0 votes
asked Jul 26, 2014 in javascript library by Pete

I am using boostrap multiselect dropdown and I need to do some action whenever the user select item / items from dropdown. I am using onChange event to do the action. But the problem is, the event raised for each selection in the drop. But what I need is, something like "leave focus" event which should be raised after the user completed his/her selection and come out of that dropdown. Is there ant leave focus event available in bootstrap multiselect dropdown library?

jQuery('#availablePositions').multiselect({
        nonSelectedText: 'Select positions',
        includeSelectAllOption: true,
        includeSelectAllIfMoreThan: 5,
        selectAllText: 'Select all positions',
        maxHeight: 300,
        buttonWidth: '100%',
        onChange: function(element, checked) {
            FillDevicesDropdown(jQuery('#availablePositions').val());
        }
    });
Share

1 Answer

+1 vote
answered Jul 26, 2014 by Aadhira (1,213 points)
selected Jul 26, 2014 by administrator
 
Best answer

As per the information provided in bootstrap multiselect dropdown jquery library,
you should be able to use "onDropdownHidden" as long as you are using Bootstrap version 3 and above. Here is what given in the website.

onDropdownHide
This event handler is triggered when the dropdown are hidden.

Both, the onDropdownShow and the onDropdownHide options are not supported when using Twitter Bootstrap 2.3.

So, you may change onChange event with "onDropdownHide" event.

jQuery('#availablePositions').multiselect({
        nonSelectedText: 'Select positions',
        includeSelectAllOption: true,
        includeSelectAllIfMoreThan: 5,
        selectAllText: 'Select all positions',
        maxHeight: 300,
        buttonWidth: '100%',
        onDropdownHide: function(event) {
            FillDevicesDropdown(jQuery('#availablePositions').val());
        }
    });

bootstrap multiselect dropdown jquery library website

Your answer

Preview

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
site design / logo / content © 2013 - 2015 pinfaq.com
...