Mar
8
8
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).
<div class="content"> Write Something! </div> <br /> <button>Write</button> <button>Append</button> |
Here is the jQuery code to write data:
$("#write").click(function(){ $(".content").html("Hello World! "); }); |
Here is the jQuery code to append data:
$("#append").click(function(){ $(".content").append("Hello World! "); }); |
Cheers,
3 Comments to “Basic jQuery Tutorial: Write or Append content to DIV”
Sign up for our mailing list.
Categories
Recent Comments
- Shankar on 8 Best WordPress Video Plugins
- Shankar on 5 Cool Video plugins for WordPress
- irshad on Creating Secure Login in PHP
- jaliya on How to refresh DIV using jquery
- anika on How to insert twitter updates in your webpage













Basic jQuery Tutorial: Write or Append content to DIV http://bit.ly/cBbRIP
Basic jQuery Tutorial: Write or Append content to DIV http://is.gd/9Yc1S #jQuery #tutorial
Basic jQuery Tutorial: Write or Append content to DIV http://is.gd/9Yc1S #jQuery #tutorial