In your sample you're missing a closing bracket for the function, and
LoopComplete would only be declared but not run. I think you meant

$(document).ready(function() {
   $('input[name=category]').each(function() {
        //...
   });
  alert("All done with loop!");
});

johannes: everything in Javascript is synchronous, except for Ajax
calls (or timeouts/intervals - they are synchronous too but will
execute in a different order). So the alert here will only fire after
each() has done it's job. Also note that the '@' for attribute
selectors has been deprecated in jQuery 1.2.6, and removed in 1.3
(will error).

- ricardo

On Jan 28, 2:47 pm, "Rick Faircloth" <r...@whitestonemedia.com> wrote:
> MZ... what role does the first "LoopComplete();"
> play in the code in your response at the bottom of the page.
>
> How would the code behave differently if it was just
>
> $(document).ready(function() {
>      $("inp...@name='category']").each(function() {
>
>      });
>
> function LoopComplete() {
>      alert("All done with loop!");
>
> });
>
> Thanks for any guidance and info...
>
> Rick
>
> > -----Original Message-----
> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> > Behalf Of MorningZ
> > Sent: Wednesday, January 28, 2009 10:32 AM
> > To: jQuery (English)
> > Subject: [jQuery] Re: function after "each" -loop
>
> > Just put the call after the each loop
>
> > $(document).ready(function() {
> >      $("inp...@name='category']").each(function(){
>
> >      });
> >      LoopComplete();
> > });
> > function LoopComplete() {
> >      alert("All done with loop!");
> > }
>
> > On Jan 28, 10:13 am, johannesF <johannes.foss...@gmail.com> wrote:
> > > Hi
>
> > > Need som smart advice here, I have a "each"loop like this.
>
> > > $("inp...@name='category']").each(function(){
>
> > > });
>
> > > And then I want to run a function after the "each" i done Is that
> > > possible?
>
> > > all the best / johannes

Reply via email to