Skip to content
Advertisement

(Javascript) oninput with numbercheck

I’m trying to make a simple inventory systems. But I’m having problem with my oninput event.

I want to make TOTAL GOODS to be “Please input number in GOODS IN ” whenever every non number value inserted into GOODS IN. But it seems I can’t make it so.

JavaScript
JavaScript

Advertisement

Answer

Just add type = “number” in the input label for TOTAL GOODS. It should prevent user from entering any alphabet. Except “e”

JavaScript

As pointed out, if you want to show an alert or something when an input of alphabet is there in TOTAL GOODS, you can just add

JavaScript

and in the function you can check the input for :

JavaScript

if you want GOODS IN to be numeric just change the type of the label accordingly

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement