I have added a checkbox to a form that the user can dynamically add rows to. You can see the form here.
I use an array to pass the values for each row to a PHP emai
Change the value for each checkbox to something unique:
etc. In order to do this from your jQuery code, add another line that assigns the value to the new checkbox:
x.find('input:checkbox').each(function() { this.value='Yes-'+n; });
You'll have to define n on the initial page load. Assuming you start with only one "person", just add right above your $(".add").click handler:
var n=1;
And then:
$(".add").click handler, increment the value of n$(".remove").click handler, decrement the value of n