Q:

Hiding the text in an element with JS (not the element itself)

Is there any way to hide the text in a HTML element, and not the element itself, using JavaScript? So if one had
<span style="border: 1px solid green">Hello world!</span>

how could one hide the "Hello world!" but not the border? If there is also a simplified jQuery solution, can you include it too?

A:

Yes there is. it's called .wrapInner().
$("div").wrapInner('<span class="hide" />');

DEMO: http://jsfiddle.net/9KzgJ/

