I have this problem in jQuery:
I have a button that when clicked calls a function to create a div with an incremental id, equal to the number of clicks made. Here's my simplified solution:
$(document).ready(function() {
  var count = 0;
});
$("#button").click(function() {
  count = count + 1;
  addDiv(count);
});
But, if I define the function click here, the id on my div is NaN while if I put the function of click in document.ready(), it creates two divs. I only want to create a div with incremental Id for each click!
 
     
     
     
     
     
    