Reputation: 5250
I am using this plugin http://vst.mn/selectordie/ for making dropdowns. But I can't figure out, how I can make another element close the menu.
I have made a fiddle http://jsfiddle.net/Lgq1grrm/1/
$("select").selectOrDie();
$(".closeSelect").on('click', function(e) {
e.stopPropagation();
});
can someone help, please
Upvotes: 1
Views: 378
Reputation: 74410
Just remove specific classes:
$(function(){
$("select").selectOrDie();
$(".closeSelect").on('click', function(e) {
e.stopPropagation();
$(".sod_select").removeClass('focus open');
});
});
Upvotes: 0
Reputation: 113485
I browsed the code a little bit, but it looks like this plugin doesn't have such a method.
However, we can hack it, following what happens on the click on an option:
$("select").selectOrDie();
$(".closeSelect").on('click', function() {
$(".selected, .sod_placeholder", "select").removeClass("selected sod_placeholder");
$("select").removeClass("open");
});
Upvotes: 3