Question
JavaScript Can Validate Input Please input a char between 'd' and 'm': Submit function myFunction() { var x, text; //Get the value of the input
JavaScript Can Validate Input
Please input a char between 'd' and 'm':
function myFunction() {
var x, text;
//Get the value of the input field: id="numb"
x = document.getElementById("character").value;
// If x is Not a char
// or >= than 'd' or <= than 'm'
else {
// text is ok
}
document.getElementById("WEBT2300").innerHTML = text;
}
Which code will do the above?
Question 11 options:
| if (!NaN(x) && x >= 'd' && x <= 'm') { text = "Input not valid"; } else { // text is ok text = "Input OK"; } |
| if (!isNaN(x) && x > 'd' || x < 'm') { text = "Input not valid"; } else { text = "Input OK"; } |
| if (!NaN(x) && x >= 'd' || x <= 'm') { text = "Input not valid"; } else { // text is ok text = "Input OK"; } |
| if (!isNaN(x) || x >= 'd' && x <= 'm') { text = "Input not valid"; } else { // text is ok text = "Input OK"; } |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started