How can I add validation for the HTML5 input type range?
It should not be 0. How can I add a warning message, like the default validation messages on other HTML5 input types?
How can I add validation for the HTML5 input type range?
It should not be 0. How can I add a warning message, like the default validation messages on other HTML5 input types?
Example: <input type="number" size="6" name="age" min="18" max="99" value="21">
Some more examples: HTML5 Validation Types
You can check if the user press the key with an eventlistener via jquery and prevent the use of it
$("input").addEventListener("keypress", function (evt) {
/*your condition*/
if ( evt.which == /*your keycode*/ )
{
evt.preventDefault();
alert(); /*you error message/code*/
}
});