my problem is the following - i need a jquery hide/show such as toggle() to hide and show a div. If i click outside of that div i need it to hide() , and if i click inside it , i want it to stay .I will have forms inside it , and i would like if click/type in them - the children of the div , the div to stay shown.
I have tried this -
$(document).ready(function(){
$("#dropdown-btn").click(function(){
$(this).find("#dropdown").toggle();
});
});
$(document).on("click", function(event){
var $trigger = $(".dropdown-btn");
if($trigger !== event.target && !$trigger.has(event.target).length){
$(".dropdown").hide();
}
});