I have a stop and a reset button. The stop button enables multiple buttons on the DOM that are disabled when the user hits start. The reset button also enables the same buttons. If the user presses stop and then reset, I'd rather not try to re-enable the same buttons. In fact, I think it may cause some bizarre behaviour.
Is there a way to test if the click event for a button has been re-enabled by, say, the stop button before trying to enable it by the reset button?
$('#stop').click(function() {
clearInterval(watchHandler);
clearInterval(breakHandler);
if (breakInterval !== 1) {
$('#minusSession').on('click', minusSession);
$('#plusSession').on('click', plusSession);
}
$('#minusBreak').on('click', minusBreak);
$('#plusBreak').on('click', plusBreak);
$('#start').on('click', startLogic);
});
function resetLogic () {
clearInterval(watchHandler);
clearInterval(breakHandler);
$('#minusSession').on('click', minusSession);
$('#plusSession').on('click', plusSession);
$('#minusBreak').on('click', minusBreak);
$('#plusBreak').on('click', plusBreak);
$('#start').on('click', startLogic);
}