Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
psadri
on Sept 15, 2022
|
parent
|
context
|
favorite
| on:
The number input is the worst input
HTML inputs have APIs for checking their validation state. The input returning "" in invalid state is easy to test for:
const num = numInput.checkValidity() ? numInput.value : 0; // or some other default
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
const num = numInput.checkValidity() ? numInput.value : 0; // or some other default