I delete unnecessary characters from the input field as follows:
$(document).on('input','#num',function() { this.value = this.value.replace(/[^\d\.]/ig,''); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input id="num"> But so any change in the field resets the cursor to the end. Here you can come up with something or need a different approach?
type="number"- Grundy