Using jQuery , you can add(create) html content. For example, if you want to add some html to each 'div' element, you can do it as :
You can get the html by using jQuery and also can modify it .For example, you can get the paragraph which is clicked and can convert it from html to text :
The page looks like :
When you click on any paragraph, for example here we click on 'click', it will show you :
You can also set the html content to matched element. For example, you can set the html content to each filtered elememts :
Consider the following code :
<div class="demo-box">Demonstration Box</div>
You can set the html content inside 'demo-box' div class using following code :
.html('<p>All new content. <em>You bet!</em></p>');
The above line will change the content and produce output something like this :
<p>All new content. <em>You bet!</em></p>
Learn from experts! Attend jQuery Training classes.
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles