I have next input
<input type="number" name="min" ng-model="vm.item.min" ng-max="vm.item.max" required >
But I can type string data here (in Edge Browser). How can i fix it?
I have next input
<input type="number" name="min" ng-model="vm.item.min" ng-max="vm.item.max" required >
But I can type string data here (in Edge Browser). How can i fix it?
window.addEventListener("input",function(e){
e.target.value=parseFloat(e.target.value)||0;
});
A js solution. Whenever theres some input, replace the value with the Number representation of it... http://jsbin.com/xisamadene/edit?output
Change "input" to "change" if you want the replacement to appear when the user leaves the element