Basic jQuery Tutorial: Write or Append content to DIV

In this article, I will be showing you how to write or append content to DIV. When you write, all the text present before will be replaced by new content. When you append, new content will be added after the previous content already present there.


Here is my html code. This contains a div with class ‘content’ and two buttons (Write and Append).

Write Something!

Here is the jQuery code to write data:

	$(".content").html("Hello World! ");				

Here is the jQuery code to append data:

	$(".content").append("Hello World! ");				


Cheers (by chelsie),