- 1

What JavaScript custom form validation??How to do that

8th Aug 2017, 7:45 PM
Charith Madusanka Liyanarachchi
Charith Madusanka Liyanarachchi - avatar
2 Réponses
+ 2
<!DOCTYPE html> <html> <body> <h2>JavaScript Can Validate Input</h2> <p>Please input a number between 1 and 10:</p> <input id="numb"> <button type="button" onclick="myFunction()">Submit</button> <p id="demo"></p> <script> function myFunction() { var x, text; // Get the value of the input field with id="numb" x = document.getElementById("numb").value; // If x is Not a Number or less than one or greater than 10 if (isNaN(x) || x < 1 || x > 10) { text = "Input not valid"; } else { text = "Input OK"; } document.getElementById("demo").innerHTML = text; } </script> </body> </html> sample code taken from https://cheeze.club/y8uv
9th Aug 2017, 1:23 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
0
thanks bro.big help😘
9th Aug 2017, 4:11 AM
Charith Madusanka Liyanarachchi
Charith Madusanka Liyanarachchi - avatar