Below jQuery's deferred fail()
only executes once, why?
var dfd = $.Deferred();
$('button').on('click', function(){
if(typeof lorem === 'undefined') {
return dfd.reject();
}
});
dfd.fail(function(){
alert('Variable lorem is not defined');
});
https://codepen.io/bartclaeys/pen/EOooKy
Expected behavior: When you click the button repeatably, the alert should fire repeatedly.