Answered step by step
Verified Expert Solution
Question
1 Approved Answer
function checkName(){ var user_name = document.getElementById(name); var pos = user_name.value.search(/^[A-Z][a-z]+ ?[A-Z][a-z]+/); if (pos != 0) { alert(The name you entered ( + user_name.value + )
function checkName(){ var user_name = document.getElementById("name"); var pos = user_name.value.search(/^[A-Z][a-z]+ ?[A-Z][a-z]+/); if (pos != 0) { alert("The name you entered (" + user_name.value + ") is not in the correct form. " + "Please re-type your name"); user_name.focus(); user_name.select(); return false; } }
Can someone please explain this part of code, in simple terms, line by line of what is happening? I understand the first line of the fucntion, but get lost after.
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