How can I change the text inside my <span> with jQuery?

I have a really simple question but it's something I have not done before. I have the following:

<td id="abc" style="width:15px;"><span></span></td>

I would like to put some text into the span.

How can I do this with jQuery. I know how to change things with the id of abc but not the code inside the span.

thanks,


Solution 1:

$('#abc span').text('baa baa black sheep');
$('#abc span').html('baa baa <strong>black sheep</strong>');

text() if just text content. html() if it contains, well, html content.

Solution 2:

This will be used to change the Html content inside the span

 $('#abc span').html('goes inside the span');

if you want to change the text inside the span, you can use:

 $('#abc span').text('goes inside the span');

Solution 3:

$('#abc span').html('A new text for the span.');