I've created a toggle menu using jQuery it works fine but how can hide dropdown-contents when click outside it.please help me. thanks i'm making a website for product reviews and user submitted posts. i need some help to make it successfully.
<script>
$(".dropbtn").click(function(e){
$(".dropdown-content").toggle();
e.preventDefault();
});
$(".dropbtn").click(function(e){
$(this).hide();
e.preventDefault();
});
$(".dropbtn").click(function(e){
$(".dropbtnhide").show();
e.preventDefault();
});
$(".dropbtnhide").click(function(e){
$(".dropdown-content").hide();
e.preventDefault();
});
$(".dropbtnhide").click(function(e){
$(this).hide();
e.preventDefault();
});
$(".dropbtnhide").click(function(e){
$(".dropbtn").show();
e.preventDefault();
});
$(".dropdown-content").click(function(e){
e.preventDefault();
});
</script>
.dropbtnhide{display:none; position:relative;}
.dropbtn{display:inline-block; position:relative;}
<!-- begin snippet: js hide: false console: true babel: false -->
<div class="celldisplay dropdown">
<button class="dropbtnhide "><i class="far fa-ellipsis-h"></i></button>
<button class="dropbtn"> <i class="far fa-ellipsis-v"></i></button>
<li><a></a>
</li>
</div>