title: Calculate discount price dynamically using jquery
body: <p>I am having a form which can calculate the discounted price of what we addded in MRP input field. The number of rows can be increased by pressing a button.</p>
  
  <p>Where the button appends the following code in the table</p>
  
  <pre><code>$("#add-book").click(function(){
      $(".books").append('&lt;tr&gt;&lt;td&gt;&lt;select name="subject"&gt;&lt;option disabled="" selected=""&gt;Subject&lt;/option&gt;&lt;option&gt;Microprocessors Microcontrollers&lt;/option&gt;&lt;option&gt;Compiler Design&lt;/option&gt;&lt;option&gt;Operating Systems&lt;/option&gt;&lt;option&gt;Artificail Intelligence&lt;/option&gt;&lt;option&gt;Web Engineering&lt;/option&gt;&lt;/select&gt;&lt;/td&gt;&lt;td&gt;&lt;input name="title" type="text" placeholder="Title of book..." maxlength="64"&gt;&lt;/input&gt;&lt;/td&gt;&lt;td&gt;&lt;input name="author" type="text" placeholder="Author..." maxlength="64"&gt;&lt;/input&gt;&lt;/td&gt;&lt;td&gt;&lt;input name="mrp" type="number" placeholder="MRP" maxlength="4"&gt;&lt;/input&gt;&lt;/td&gt;&lt;td class="individual-noteshub-value"&gt;&lt;input name="individual-noteshub-value" type="text" disabled=""  value="0"&gt;&lt;/input&gt;&lt;/td&gt;&lt;/tr&gt;');
  }
  </code></pre>
  
  <p>It gives the result for the first row but upon adding rows, It can not calculate the discounted price for proceeding rows.</p>
  
  <p>The Js code for calculating, i am using is :</p>
  
  <pre><code>$(function(){
  $('input[name="mrp"]').closest('td').find('input[name="mrp"]').on('input',function(){       
  
      $(this).closest('td').next().find('input[name="individual-noteshub-value"]').val($(this).val()/2);
  });
  
  $('input[name="pages"]').on('input',function(){     
      $(this).closest('td').next().find('input[name="individual-noteshub-value"]').val($(this).val()/4);
  });
  </code></pre>
  
  <p>}); </p>