[jQuery] Prepending different content to an element

[jQuery] Prepending different content to an element


I have a table with multiple <td> elements. Each contains an <a>
hreference. I want to add text before each <a> tag, but it is text
dependent on the contents of the <a> tag. I can use the prepend()
function to add a fixed piece of text as in
$("td").prepend("

fixed piece of text

")
That works fine. But I'm trying to make the text depend dynamically on
the contents of the <a> tag. Something like
$("td").prepend($("a").text())
I get no text prepended, in any way that I have tried. Does anyone
have any ideas about this or similar situations?
TIA,
Jan