Question: 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
Get step-by-step solutions from verified subject matter experts
