Hi all,
I'm trying to let a user to do a 'Click here to add more info' link. I'm trying to do this with input fields so that the id of the field have to increment.
I would like for jQuery to add this on every click where $i is the number of each field incremented:
<?php echo $form->input("User.$i.first_name"); ?>
Add info
Here is my jQuery code so far:
var current = 1;
$('#addInfo').click(function(){
var newField = 'Info#' + current + '
';
$('#info').append(newField)
current++;
return false;
});
One of the solution I came up with is just manually create the input fields inside the javascript and assign it to the newField. I think there should be a way where I can create a first working set and then use jQuery to copy that first content and then just increment the count for new fields.
Thanks!