jQuery removeClass() not working but hasClass() works : I am using some CSS classes and jQuery to make a custom selectbox. But I keep having problems with the removeClass() function.
I know there are alternatives to this problem. But could somebody explain me WHY it is not working? 

	$(".filterselect").on("click",function(){
		$(this).find("ul").addClass("open");
	});

	$(".filterselect ul li").on("click",function(){
		$(this).parent().find("li").removeClass("active"); // THIS WORKS
		$(this).addClass("active"); // THIS WORKS
		if ($(this).parent().hasClass("open"))
		{
			console.log("test"); // THIS WORKS
		}
		$(this).parent().removeClass("open"); // THIS DOESN'T WORK :(
	});

Thanks for the help!