In this example, we are determining if your input text-box already has a decimal point , if you want to prevent enter another decimals character in the same text-box . After entered another decimal dot (.), the ASCII value will matches another entered decimal point in your text-box and remove if multiple entry . Let's see the example - app.directive( 'allowOnlyDecimalNumbers' , function () { return { restrict: 'A' , link: function (scope, elm, attrs, ctrl) { elm.on( 'keydown' , function (event) { var $input = $( this ); var value = $input.val(); ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers