In the 5th lesson of the jQuery Crash-Course we learn how to add and remove elements dynamically.
The example for this lesson is adding and removing simple list items when clicking on the add or remove links.
$(function() {
var i = $('li').size() + 1;
$('a#add').click(function() {
$('You can see all the code by viewing the source of this page (Ctrl-U in most browsers).