Search This Blog

Thursday, March 19, 2020

Character Restrict From a Item and Only Numeric Will Allowed

1. Copy The Below Code to Page Function and Global Variable Declaration. 
function validateNumber(event) {
  var keyCode = event.keyCode;
  var excludedKeys = [8, 37, 39, 46];

  if (!((keyCode >= 48 && keyCode <= 57) ||
      (keyCode >= 96 && keyCode <= 105) ||
      (excludedKeys.includes(keyCode)))) {
    console.log("alphabets are not allowed");
    event.preventDefault();

  }

  console.log("keycode: " + keyCode);
}
2.  And Copy the below function Calling on Item Custom Attribute.
onkeydown="return validateNumber(event)";  


No comments:

Post a Comment

Create a Form Using Python for Save Data into Excel like a Database

#Download Pyhton from here https://www.python.org/downloads/  #Download Python: #Click the “Download Python 3.x.x” button (the latest versio...