I have text field in my application which should accept only positive integers only.(no decimal, no negatives). Basically I want to restrict the user to enter only between 1 to 9999 only.
<input type="text" min="0" max="99" number-mask="">
I found this from googling jsfiddle it accepts negative integers and it doesn't work with internet explorer.
I don't have mush experience writing directives. At the moment I am learning angular as well. (I use typscript to generate angular in my .net mvc project)
var app = angular.module('myApp', []);
app.directive('numberMask', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
$(element).numeric();
}
}
});
In this code is it possible to check for negatives? Something like
if(element <0 && element.lenth > 4)
.....
else
....
Thanks in Advance