0
Q:

prevent user from typing e,+,- from number input

<input type="number" id="inputBox" />
0
var inputBox = document.getElementById("inputBox");

var invalidChars = [
  "-",
  "+",
  "e",
];

inputBox.addEventListener("keydown", function(e) {
  if (invalidChars.includes(e.key)) {
    e.preventDefault();
  }
});
0

New to Communities?

Join the community