i want to turn
<a href="#">test</a>
into
<a href="#"><span>test</span></a>

so...

$("a").prepend("<span>").append("</span>");

doesnt work because of the open tag. the first span is closed and the
second span is thrown away. (this quality should be noted in the docs,
i think.)

$("a").wrap()

would apply content to the outside of the link

$("a").html().wrap(..)

html() breaks chaining

which leaves us with

$('a').each(function(){ $(this).html('<span>'+ $(this).html() +'</
span>') });

surely there is a less ugly way, or no?

if not, i would like to propose something along the lines of
innerWrap(). same as wrap() but applies content to inside of element.

Reply via email to