That depends on:
- The purpose of the input field.
- What an User expect the page. (User Experience standpoint)
Lets discuss an example:
- For an e-shop page does not make sense to deal with negative numbers, even for discounts.
- For an dashboard page negative numbers can be used to plot graphs.
The best practice is to evaluate your requirements, and only if some feature is needed you implement it.
The common sense tell that every number is always positive, unless stated otherwise.
For the Validation
Using HTML Alone
Give your input tag a type number and let the browser do the validation for you.
Quote from MDN (check link below):
input elements of type "number" are used to let the user enter a number. They include built-in validation to reject non-numerical entries.
<input type="number" min="0" max="99">
On the input, you can place your custom validation function to be called on some event.
<input type="number" onkeypress="myCustomValidation()">
In this case, the function myCustomValidation will be called in response to the event automagically. Just choose an appropriate event to use.
MDN - Input - Type Number
MDN - Events List
StackOverflow - Input - Prevent Negative