Microsoft
98-382 · Question #36
You are creating a web page that tests a user's ability to accurately type text. The validation should be case-insensitive. How should you complete the code? To answer, move to answer, move…
The completed code should look like this: <!DOCTYPE html> <html> <head> <script> function validate() { var input = document.getElementById("tester").value; var text = document.getElementById("userText").innerHTML; if (input.toLowerCase() == text.toLowerCase()) {…
Performing Operations
Question
You are creating a web page that tests a user's ability to accurately type text. The validation should be case-insensitive. How should you complete the code? To answer, move to answer, move appropriate functions to the correct locations. Each function may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Explanation
The completed code should look like this:
<!DOCTYPE html> <html> <head> <script> function validate() { var input = document.getElementById("tester").value; var text = document.getElementById("userText").innerHTML; if (input.toLowerCase() == text.toLowerCase()) { alert("Success"); } } </script> </head> <body> <p id="userText">When in the course of human events...</p> <input type="text" id="tester" /> <button onclick="validate()">Validate</button> </body> </html>The correct segments for the respective boxes in the provided template are: Box 1: value Box 2: innerHTML Box 3: toLowerCase() Box 4: toLowerCase()
Topics
#string methods#toLowerCase#string comparison#validation
Community Discussion
No community discussion yet for this question.