首页 > 代码库 > Code-School:jQuery学习笔记

Code-School:jQuery学习笔记

    1. 把<script></script>的标签放在</body>之前
    2. $.ready()要先于$.load()执行
    3. $("#div1 > li") //direct child selector:选取div1下的直接子元素
    4. $("#div1, div2") //multiple selector
    5. $("ul :first") //伪对象选择符:取第一个ul元素。The :first pseudo-class is equivalent to :eq( 0 ). It could also be written as :lt( 1 ). While this matches only a single element, :first-child can match more than one: One for each parent.
    6. $("ul > li :even");
    7. $(div).find(p:contains(love));    最后一行代码很炫,:contains()是一个选择器
    8. $("#div1").first() //As you are looking through your code, you notice that someone else is selecting the last vacation with: $("#div1 :last"). You look at this and you think,"Traversal would make this way faster!".这就是使用DOM和使用CSS选择器的区别。
    9. $("#div1").last().prev();  //获取倒数第二个
    10. $(".featured")/parent();
    11. $("#div1").children();  //用DOM来实现第3条功能

Code-School:jQuery学习笔记