title: jquery increment number using .each()
body: <p>how do i increment id using .each() function.</p>
  
  <pre><code>$("input:checked").each(function(){
  var counter = $(this).length();
  var id_bookslot = data; //&lt;-- increment id +1
  var treatment_type = $(this).closest("div").attr("id");
  var id_treatment = $(this).attr("class");
  $.post("include/get_booking.php?insert", {id_bookslot: id_bookslot,id_treatment:id_treatment,treatment_type:treatment_type});
  });
  </code></pre>
  
  <p>let say, there are 3 checkboxes are checked! so the id will be incrementing until 3(1,2,3).</p>
  
  <p>i forgot to mention var id_bookslot = data. <code>data</code> which is an id that i retreive from database. let say it starts with 1234. and everytime .each() generate, it will increment by 1. 1234, 1235, 1236</p>