Jquery Selectors

Card Set Information

Jquery Selectors
2012-07-09 14:47:43

Goes over the basic types of jquery selectors.
Show Answers:

  1. If you have multiple items that you want to select, how do you deliminate between them? 
    A comma ,
  2. If you want something selected that has multiple classes, how would you do it.
    right next to each other as in .class1 .class2
  3. You want to have all elements that are childs with direct parents. For instance. you want to select all li tags in the ul list.
    • parent > child
    • as in parent.classname > li
  4. You want to select certain descendents of a certain parent. Not necessarily parent child, but ALL descendent options that you want to select
    ancestor descendent as in ul.bob li
  5. Find all elements that are next to a certain other element. For instance, you want to find all p elements that are next to ul.bob 
    ul.bob + p.  So it's previous + next
  6. Find all sibling elements that match a certain set of circumstances For instance, you want to find all li elements after li.firstOne that have the class "listItem"
    li.firstOne ~ li.listItem as in prev ~ sibling
  7. What is the standard format for a selector to go in?
    • $(" ").whatever you are looking to change.
    • as in $(".list") selects all items with a class of list.