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.
擁有了本章我們講過的知識後,我們現在可以通過很多方法定位網頁上的一串元素。特別的,我們學會了使用基礎的css選取器在嵌套的結構中去定位頂部和子級的元素,學會了使用屬性選取器為不同類型的連結加上不同的樣式,使用定製選取器:odd和:even或者進階選取器:nth-child()給一個表加上交替的條紋,使用鏈狀jquery方法為特定的表格塊高亮文本。
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.