0
How do I restrict a number with JavaScript
<label for="fname">Name</label> <input type="number" id="fname" name="firstname" placeholder="Your name.." required> <button onclick="f()">Try it</button> var x = [10, 11]; function f() { document.getElementById("fname"); if (x == true) { alert("cant use such number"); } else { alert("cool"); } } What do I do when I don’t want some specific numbers to be inputted
2 Respostas
0
Exist an range input type that do this:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range
0
Doesn’t lucid. I want to do it with JavaScript