0

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?

1
  • you can use javascript or jquery for your purpose. Commented Apr 18, 2017 at 13:47

1 Answer 1

2
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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.