views:

50251

answers:

2

Hi,

How could I achieve the following using jQuery, i.e:

document.all.regTitle.innerHTML = 'Hello World';

where regTitle is my div id.

Thanks.

+49  A: 
$("#regTitle").html("Hello World");
Zed
I think you mean ';' not '.' :)
David Claridge
Thanks. Some languages build bad habits...
Zed
@Zed What language? English?
Adriano Varoli Piazza
No, it's Erlang :D
gleber
+27  A: 
$('#regTitle').text('Hello world')

will set any text content, or, if you want to replace the entire HTML structure:

$('#regTitle').html('Hello World');

The html() function can take strings of HTML, and will effectively modify the .innerHTML property.

zombat