Skip to content

Commit f867852

Browse files
author
ehynds
committed
Check to make sure the event target isn't the menu in the document click handler. fixes #355
1 parent 21c61cf commit f867852

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/jquery.multiselect.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,15 @@
399399
});
400400

401401
// close each widget when clicking on any other element/anywhere else on the page
402-
$doc.bind('mousedown.' + this._namespaceID, function(e) {
403-
if(self._isOpen && !$.contains(self.menu[0], e.target) && !$.contains(self.button[0], e.target) && e.target !== self.button[0]) {
402+
$doc.bind('mousedown.' + this._namespaceID, function(event) {
403+
var target = event.target;
404+
405+
if(self._isOpen
406+
&& !$.contains(self.menu[0], target)
407+
&& !$.contains(self.button[0], target)
408+
&& target !== self.button[0]
409+
&& target !== self.menu[0])
410+
{
404411
self.close();
405412
}
406413
});

0 commit comments

Comments
 (0)