I use $().each()to scroll some elements. I want to make sure that the action that follows this script fragment is only executed after completion each().
Example:
$('something').each(function() {
});
$('item').etc
It seems to work at this stage, because this is really the main action. But sometimes this fails and it seems that the part each()is still busy, as a result of which the action of the subsequent script will be overwritten by the actions each().
So ... is this possible? Or the code under each function () is always executed after the previous code. I know that, for example, AJAX calls have a “success” function to force the code to execute only when the parent action completes. Is it necessary / possible here? I tried something like the following, but this does not seem to work:
$('something').each(function() {
}, function () {
});
source
share