invalidLabel(thisTag.parentNode);
This line of code has been added to the invalid check inside
validTag(). When the current field fails validation, we want to check to see if we can also invalidate the label surrounding the problem child. To do this, call the new
invalidLabel() function (explained below) and pass it the
parent of our current tag. That is, if there's a problem with the
passwd1 input field, we want both that tag
and the
label tag around it to be assigned a
class of
invalid. So, once we know that the
passwd1 input field has a problem, we pass its parent (the
label tag) over to
invalidLabel() to see if it's an appropriate element to mark invalid.