Oh, i thought the $("a") was just an example... Anyways, OP shouldnt be
putting spans inside of an anchor, <a> is a block level element, meaning
text and linebreaks only inside of it.

On 6/2/07, Erik Beeson <[EMAIL PROTECTED]> wrote:


> .html only breaks chaining if you dont pass an argument, so try this
out:
>
> $("a").html("<span>"+$("a").html()+"</span>");

Except $('a').html() will always return the content of the first link,
so that will set all links to have the same text as the first link.
You need to wrap it in each() like the OP did.

I don't think there's anything wrong with the $('a').each(...) version
from the OP. If you want to shorten it up, just make it a little
plugin. I think it's a rare enough case that it doesn't warrant
addition to the core.

--Erik

Reply via email to