Jump to content


Photo

Chapter 1


  • Please log in to reply
2 replies to this topic

#1 nanonerd

nanonerd

    New Member

  • Members
  • Pip
  • 1 posts

Posted 30 October 2011 - 02:33 PM

Greetings from Brigantine, NJ ... ;-)

I just finished Chapter one. Pretty cool and clear cut. The method of teaching is quite intriguing with all the pictures, etc. I like it, so far !

QUESTION: page 9, in the 2nd jQuery example, it uses the same exact code as the first ... but what if you only wanted to "Change the page" in the first 5 "p" elements as it does in the FOR Loop in the javascript example?

Doesn't *** $("p").html("Change the page."); *** change all the "p" elements?

QUESTION: page 16, a minor typo? is the first jQuery statement in the first cloud missing a semi-colon?

QUESTION: page 17, bottom, are elements allowed to have the same id in the same page? <p id="mytext"> is shown twice ... just curious ... a simple "yes" or "no" will suffice ... i'm no expert on HTML but from a conceptual point, I just assumed that an ID is usually to keep something unique ...

#2 LongLiveCHIEF

LongLiveCHIEF

    Active Member

  • Members
  • PipPip
  • 20 posts

Posted 27 February 2012 - 10:35 PM

Question 1: You are correct, in the javascript example the use the zeroth element of that object type, whereas in the jQuery example, they oversimplified it to convey a point. You would need to add a first-child filter to the selector to duplicate the results.

Question 2: It's also missing a closing parenthesis. It should be $("button").click(function(){});

Question 3: ID's should be unique by conventional standards, but nothing stops people from doing it, and the browser won't even go into quirks mode with this.

Edited by LongLiveCHIEF, 27 February 2012 - 11:26 PM.


#3 LongLiveCHIEF

LongLiveCHIEF

    Active Member

  • Members
  • PipPip
  • 20 posts

Posted 28 February 2012 - 06:18 AM

Question 1: You are correct, in the javascript example the use the zeroth element of that object type, whereas in the jQuery example, they oversimplified it to convey a point. You would need to add a first-child filter to the selector to duplicate the results.

Question 2: It's also missing a closing parenthesis. It should be $("button").click(function(){});

Question 3: ID's should be unique by conventional standards, but nothing stops people from doing it, and the browser won't even go into quirks mode with this.


And by first child, I really mean eq filter. :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users