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

29th Apr 2018, 12:31 PM
klisco1
2 odpowiedzi
29th Apr 2018, 12:46 PM
KrOW
KrOW - avatar
0
Doesn’t lucid. I want to do it with JavaScript
29th Apr 2018, 12:51 PM
klisco1