Daniel Friesen ha scritto:
> 
> So for that example:
> 
> var list = ['foo', 'bar', 'baz'];
> var ul = pf('#myul');
> 
> list.forEach(function(data) {
>     ul.append('li').text(data);
> });
> 
> 
> So the question is, "How does one do something like this in jQuery?"

var list = ['foo', 'bar', 'baz'];

$(list).each(function(i,data) {
     $("<li>").appendTo('#myul').text(data);
});

The key is the appendTo function, in order to keep the appended element 
the chainable object, on which call the text function.

Note also the use of each with an array to iterate it.

Hope this helps.

Renato

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to