title: JS - onkeypress keeps appending text to end
body: <p>In my Angular app i have an input field with <code>onkeypress</code> which i use to remove any commas if entered:</p>
  
  <pre><code>&lt;input name="option" ng-model="main.optionToAdd" 
     onkeypress="this.value = this.value.replace(/,/g, '')"
  &lt;/&gt;
  </code></pre>
  
  <p>However the issue I'm facing is if after enter something in the field then go to the middle (either click or use arrow keys) then type something it always appends to end.</p>
  
  <p>Any ideas on how to fix?</p>