jQuery Add/Remove Input Fields 2
A script that uses event delegation and the .live() method for adding and deleting extra input form fields.
HTML
<form>
<input type="text" /><input type="text" />
</form>
<button id="addFields">Add another field
</button>
JavaScript
$(function ($) {
$('body').on("click", '#addFields', function () {
$('form').append('<br><input type="text" /><input type="text" />')
})
})(jQuery)