title: Focus out on enter press not working properly
body: <p>I have some input fields and a HTML table on my UI to input some data, my HTML table have some input field inside my HTML table and doing some calculations also all that are working fine</p>
  
  <p>What I am doing is:</p>
  
  <ul>
  <li>I have some input fields inside my table so when I press on tab I am focusing one next input field</li>
  <li>now there is last input field which is <code>Disc%</code> here after pressing <code>tab</code> I am creating new row (on focus out) , but that's not a good user interface because whenever I am clicking outside the <code>Disc%</code> field it is crating new row which is not correct</li>
  </ul>
  
  <p>What I am trying to do is:</p>
  
  <ul>
  <li>After <code>disc%</code> when I press enter I want to create a new row so that it will be good for user</li>
  <li>I have tried doing this but it is not working correctly as when I reach <code>Disc%</code> and press enter it does nothing and when I focus out and again come back to <code>Disc%</code> and press enter then it creates new row but on one press it shows three times, I don't know what's wrong</li>
  </ul>
  
  <p>Please <a href="https://jsfiddle.net/a3hxgf2L/1/" rel="nofollow noreferrer">check my Fiddle</a>, as I have so many calculation that's why code is bit lengthier but I have commented the line where the issue is</p>
  
  <ul>
  <li><p>when target matches disc% I am doing like below</p>
  
  <pre><code>if (e.target.matches('[name=discPercentagetd]')) {
    $(document).keypress(function(event) {  // here I am trying to create new row when enter is clicked
    var keycode = event.keyCode || event.which;
    if (keycode == '13') {
      alert("presed")
      calcDiscount(e.target.parentElement.parentElement)
      if ($(row).parent().find('tr').length - $(row).index() === 1) {
        rowappend(e.target.parentElement.parentElement.parentElement)
  
      }
    }
  
   });
  }
  </code></pre></li>
  </ul>
  
  <p>I am doing it like <code>$(document).on('focusout', (e) =&gt; {</code> because <code>ItemName</code> field in my table is <code>autoComplete</code> and when creating new row I want it to behave like the above.</p>