Input only javascript

I have input

one that only allows number. but if I make a copy to paste something else then the number it will resolve.

How can I make sure it resolves a number and nothing else (even after copying)

<input type="text" name="people" onkeypress='return event.charCode >= 48 && event.charCode <= 57'/>
      

Run codeHide result


+3
javascript jquery


source to share


No one has answered this question yet

See similar questions:

770
HTML text input only allows numbers to be entered

or similar:

7649
How does JavaScript blocking work?
7494
How can I remove a specific element from an array in JavaScript?
7432
How to check if a string contains a substring in JavaScript?
7287
What does "use strict" do in JavaScript, and what are the reasons for it?
5722
How can I remove a property from a JavaScript object?
5670
Which operator is equal (== vs ===) should be used in JavaScript comparisons?
5101
What's the most efficient way to deeply clone an object in JavaScript?
4829
How do I include a JavaScript file in another JavaScript file?
4380
For each by an array in JavaScript?
1154
Trigger a button click with JavaScript on the "Enter" key in a text field



All Articles
Loading...
X
Show
Funny
Dev
Pics