title: For loop in jquery . I need to run scripts for 20 time each with with increment
body: <p>I have no idea about loop in jquery. I want the following code to be run as for loop from product1 to product20 and check the same if quantity1 to quantity20 have no value then set it to 1.</p>
  
  <pre><code>$('#product1').change(function() {
      if(  $('#quantity1').val().length == 0 ){
          $('#quantity1').val("1");
      }
  });
  
  $('#product2').change(function() {
      if(  $('#quantity2').val().length == 0 ){
          $('#quantity2').val("1");
      }
  });
  </code></pre>
  
  <p>Thank you in advance.</p>