The button that activates the dropdown uses click rather than hover, on click, I've used jquery to add class, and to remove the class when clicked outside the button I used $(document).click. The problem is, when I click inside the dropdown menu, the class gets removed (Which will obviously happen)
Is there anyway to make an exception for the dropdown div or is there any fix I can use to solve the issue.
$(document).ready(function(){
$(".menu1TextContainer").click(function(event){
$(".menu1Container").toggleClass("addclass")
event.preventDefault();
});
$(document).click(function(event) {
if(!$(event.target).is(".menu1TextContainer")){
$(".menu1Container").removeClass("addclass"); //make all inactive
}
});
});
https://jsfiddle.net/9j3k61rg/3/
Thanks!