unbind click to div. I have two divs .i want to unbind the click event to the inside div
when the page is loaded, i want to unbind the click events to triangle.
my JQuery code:
$(".wrapper").unbind();
$(".triangles").unbind();
$(".triangles" ).click(function(){ //it is still clickable
alert("hello u clicked me");
});
<div class="wrapper">
<div class="triangles">
</div>
<div class="triangles">
</div>
<div class="triangles">
</div>
</div>
Use
.off()to unbind the event, when you need to.Example:
Another example: Here It will be clickable at first and not from the second time
Try it 🙂
Let me explain, what you did wrong in your codes