we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "javascript how to get rid of e with number input"
Abigail
05 May 2020
1document.querySelector(".your_class").addEventListener("keypress", function (evt) {
2    if (evt.which != 8 && evt.which != 0 && evt.which < 48 || evt.which > 57)
3    {
4        evt.preventDefault();
5    }
6});
7
8// 0 for null values
9// 8 for backspace 
10// 48-57 for 0-9 numbers