JavaScript multiple intervals and clearInterval
问题 I have a small program, when you click on an "entry", the editing mode is opened, and the entry is to edit locked for others. There is every 10 seconds sends an ajax request to update the timestamp in the table. $(".entry-edit").click(function() { // code loopLockingVar = setInterval(function() { loopLockingFunction(id) }, 10000); // code }); Then I have a cancel button to updating the timestamp in the table to 0 and to clear the interval. $(".entry-cancel").click(function() { // code