jQuery clone() example for adding html dynamically

by Naresh

HTML

<input type="button" id="add" value="+" />
<input type="button" id="remove" value="-" />
<div id="content">
  <input type="text" />
  <input type="text" />
  <input type="text" />
</div>

<div id="row"></div>

JavaScript

$('#add').click(function() {
	$('#content').clone().appendTo('#row');
});

$('#remove').click(function() {
	$('#content').remove();
});