DEV Community

Krixnaas
Krixnaas

Posted on

1

How to block +,-,e in input type Number?

<input  
    type="number"
    min="1" 
    step="1"
    onkeypress="return event.keyCode === 8 
|| event.charCode >= 48 && event.charCode <= 57">
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs