I'm new to js and jquery, I'm trying to open and close some menu, and it does open on first click but it is not closing after I click again.
$(document).ready(function(){
$("#toggle-menu").click(function(){
$("#btn").toggle(1000);
});
another weird thing is that if I click before the 1 second toggle end, it does work and closing
<div id="toggle-menu" ">
<input type="checkbox" id="check">
<label for="check" onclick="event.stopPropagation();">
<i class="fa fa-bars fa-2x i_dynm" aria-hidden="true"></i>
</label>
</div>
<div id="btn">
<li id="btnli">
<button>
<i class="fa fa-user-circle-o" aria-hidden="true"></i>
something
</button>
</li>
<li><button class="mb">something</button></li>
<li>
<button>
<i class="fa fa-question-circle" aria-hidden="true"></i>something else
</button>
</li>
</div>
I'd suggest going through the jQuery docs once. Also, the code above will throw an error as the
.click(function(){is incomplete. I'd also suggest using.oninstead.