Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
delaroc2

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...