Click and Clickoutside question
Hello all,
A total newbie to jQuery though loving it already. I am working on a dropdown menu provided to us by a company. However, the problem with this menu is that once I click on it, it displays the scope list, but I have to click on the same dropdown menu to close it without selecting any value. I want the menu to hide if I click anywhere else as well, except for menu entries. I am trying to use clickoutside event for this purpose but it is not working as I would like it to. Here is the code.
Binding to Click.
$('.SelectedCollection a').click(function(e){
e.preventDefault();
var sList = $('.CollectionsList');
if (sList.is(':hidden')){
sList.show();
$('.SearchFields').addClass('HideSelections');
}else{
sList.hide();
$('.SearchFields').removeClass('HideSelections');
}
});
Binding to Clickoutside.
Not sure about the implementation but here is what I am trying to do.
$('.CollectionsList').clickoutside(function(e){
e.preventDefault();
$('.CollectionsList').hide();
});
Thank you very much in advance.
Best wishes.