(3)选择元素——(15)总结(Summary)
With the techniques that we have covered in this chapter, we should now be able to locate sets of elements on the page in a variety of ways. In particular, we learned how to style top-level and sub-level items in a nested list by using basic CSS selectors, apply different styles to different types of links by using attribute selectors, add rudimentary striping to a table by using either the custom jQuery selectors :oddand :evenor the advanced CSS selector :nth-child(), and highlight text within certain table cells by chainingjQuery methods.
So far, we have been using the $(document).ready()method to add a class to a matched set of elements. In the next chapter, we'll explore ways in which to add a class in response to a variety of user-initiated events.
到目前为止,我们已经使用了$(document).ready()方法为一些匹配的元素集合添加方法。在下一章节,我们将学习如何相应用户的起始事件来添加一个类。