Things I learned the hard way XIVII

jQuery When the DOM isn't reacting to your javascript selectors as expected try a little specificity: instead of this:
  $("#item_id > a")
do this:
  $("#item_id > ul > li > a'")

Posted by jeremy 14/02/2010 at 15h41


Comments

Leave a response

  1. Zack Kitzmiller 14/02/2010 at 15h41

    You’re first code block shouldn’t work.

    the ‘>’ denotes a ‘child element,’ and ‘a’ is not a child of #item_id, but a great-grand child.

    $(‘#item_id a’) would be the proper selector, as it would match ALL generations under ‘#item_id’

Leave a comment