title: How to remove a character using backspace on input field
body: <p>I trying to make a input element that works both on mobile and web Chrome browser. Onkeypress works in Web Chrome but not in mobile Chrome browser.
  So I used oninput that works on both. </p>
  
  <p>I am concatenating a char say "-" to the input value after it exceeds 5 with the oninput event. After adding the '-' the backspace or delete key does not work. Also if cursor is moved in between the string and delete a char other than "-", it moves to the end of the string. </p>
  
  <p>Please find my code below.</p>
  
  <pre><code>HTML
  &lt;input type="text" id="inputcheck" value='' oninput="getmeValidated(this, event);"&gt;
  
  JAVASCRIPT
  function getmeValidated(element, event){    
     if(element.value.length &gt; 5){
        element.value = element.value+"-";
     }        
  }
  </code></pre>