>> var t = "";
>> $("div.title").each(function(){
>> t = t.concat(
>> "<h1>",$(this).text(),"</h1>\n",
>> "<p>",$("+ div", this).text(),"</p>\n"
>> );
>> });
>> alert(t);
>
> Btw, why are you using "concat" and not "+="? Is
> there a special reason or just personal preferences?
String.concat is faster than "+". Firefox and Opera optimize the "+="
operator, but most of the concatenation would be happening with "+" on the
right side and generating lots of temp strings, unless you did this:
t += "<h1>";
t += $(this).text();
t += "</h1>\n";
t += "<p>";
t += $("+ div", this).text();
t += "</p>\n";
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/