Web Development with jQuery®

(Elliott) #1

bapp01.indd 02/18/2015 Page 483


Exercise Answers


CHAPTER 2



  1. CSS and XPath are both acceptable answers.

  2. parents()

  3. prev()

  4. children() for immediate descendants and find() for any elements in the descendant
    hierarchy

  5. not()

  6. eq()

  7. siblings(), prev(), next(), prevAll(), nextAll()

  8. add()


CHAPTER 3



  1. You can use the mouseover() or on('mouseover') method. If you use deprecated meth-
    ods, in addition, you can use bind('mouseover') or live('mouseover').


Extra Credit: Use the hover() method.



  1. The on() method.

  2. The event.target property is used to check to see which descendant element has
    received the event. The event then bubbles up from that element to the element that the
    event handler is attached to.

  3. Provide a selector argument to the on() method describing the element you want the
    event to apply to on the parent or container element that contains the elements you
    want the event to apply to. This can also be the document object.


A


http://www.it-ebooks.info

Free download pdf