I try to understand what it is wrong with my code when I click on my button I change his class but I click again on the changed button class nothing happend I try to use on() function but the same things nothing happend
here my sample code:
$('#my-btn').click(function(){
$(this).removeClass('btn-success');
$(this).addClass('btn-danger');
$(this).html('Close');
});
$('.btn-danger').click(function(){
alert('hello world');
$(this).removeClass('btn-danger');
$(this).addClass('btn-success');
$(this).html('Open');
});
And my jfiddle for testing : https://jsfiddle.net/aqpdohL2/1/