jQuery each() and "on success"?
<p>I'm using <code>$().each()</code> to loop through some items. I want to make sure that the action that follows after this piece of script is only executed when <code>each()</code> has completed.</p>

<p>Example:</p>

<pre><code>$('something').each(function() {
  // do stuff to items
});

// do something to one of these items
$('item').etc
</code></pre>

<p>It seems to work at this point, because it's a really basic action. But sometimes it fails and it seems like the <code>each()</code> part is still busy, causing the action of the follow-up script to be overwritten by the <code>each()</code> actions.</p>

<p>So... is this possible? Or is code below the each() function always executed <em>after</em> the previous code. I know that e.g. AJAX calls have a "success" function, to force code to only execute when the parent action is completed. Is this needed/possible here? I tried something like the following, but this doesn't seem to be working:</p>

<pre><code>$('something').each(function() {
  // do stuff to items
}, function () {
  // do stuff when the each() part has completed
});</code></pre>
