I want to allow to click on my buttons on conditions. So I use the .on() method to allow to click just when the class "clickable" is present. :
$(".button").on("click", ".clickable", function () {
alert("click");
});
$("#stop").click( function () {
$(".button").removeClass('clickable');
});
But I can't click on my buttons from the beginning. Is my .on() method not correct ?
this my html structure :
<div class="button clickable">1</div>
<div class="button clickable">2</div>
<div class="button clickable">3</div>
Thank you