I realise that I can prepend stuff to an element using:
$(...).prepend(myText);
However, if myText
is, let’s say, "<span>"
, I actually want that text to appear, but .prepend()
would instead prepend an empty span element. What is the recommended way to solve this? Do I really have to HTML-escape the text manually or is there something more elegant?