Reputation:
I have the following:
<div id="info-message"></div>
I am changing the text in between the DIVs like this:
$('#info-message').html = "xxx";
However even though I can step through this in the firebug debugger I don't see any change on the screen and nothing is added when I look with firebug.
Upvotes: 1
Views: 110
Reputation:
You must use html()
method:
$('#info-message').html("xxx");
and if you want to append an element and work with its DOM you can use the following:
var contentDiv = $('<div class="content">xxx</div>');
$('#info-message').append(contentDiv);
contentDiv.css('color', 'red');
Upvotes: 1
Reputation: 165971
Because html
is a method, you need to call it like one:
$('#info-message').html("xxx");
Currently, you are setting the html
property of the jQuery object to the string "xxx".
Upvotes: 4
Reputation: 16174
The correct usage of the html()
jQuery method is:
$('#info-message').html("xxx");
And in case you wanted to retrieve the html of an element:
$('#info-message').html();
Upvotes: 2