javascript - Button responding after loop -


i have application using jquery iterates through series of checkboxes.

while iterates through, have dialog showing status of printing session. have cancel button cancel session.

<input type="button" id="cancelbutton" onclick="cancel()">      function cancel() {         stop = true;     } 

through each iteration check if stop true , if is, break out of loop. problem if press cancel button during session, cancel function run after .each loop (kind of defeating purpose). there way make button more responsive or better way approach this?

run functions in separate threads?

settimeout(function() { $('[name=check]:checked').each(function() {     printingfunction(); }); }, 1); 

Comments