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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!