Jump to content
Larry Ullman's Book Forums

Chapter 10 Page 381 And Page 415


Recommended Posts

Hello,

This is a beginner's question regarding the "creating errors messages" (pp 381) and the "putting it all together" (pp 415).

 

I'd appreciate if someone could clarify some of the code.

 

In page 318, in the HTML after the paragraph "With that HTML, elem.parentNode refers to the DIV, so appending a new child results in: ..."

 

1) Shouldn't the span in this HTML have a class = 'error', which was assigned in step 4 ?

 

2) Why do we need to add a class = 'error' to the span and to the label anyway? I am assuming it is for changing the CSS but I don't see it used in the "Putting it all together" code of page 415.

 

In page 415-420, "Putting it all together":

 

1) Why do we need the class = "two" in each DIV ?

2) How the CSS was manipulated to change the labels with error to red color.

 

Thank you very much for your help.

Link to comment
Share on other sites

Sorry for the confusion. The simple answer is you can add the error class wherever you want. I chose to add it to the label, to highlight the item. 

 

As for the class="two", that's just part of the CSS I used in that example to layout the form.

 

The CSS is manipulated by the addErrorMessage() function, which adds the error class to the label.

I worry that I haven't actually cleared this up, but it sounds like these are largely issues related to how the CSS works. Did you try the code for yourself to see the results? That might help.

Link to comment
Share on other sites

 Share

×
×
  • Create New...