I have a site that appends a textbox to a div when the user clicks a button. The textbox works great. Now, I would like to generate a unique number for the id of each box. The following code is giving me 0 as the id of each box. I'm trying to get them to go 1,2,3,4...
Code:
<?php $x=0; ?>
$("#add").click(function(){
$('#boxes').append(<input type="text" id="<?php echo $x; $x++; ?>">);
});