To complete these exercises, you will need the index.htmlfile for this chapter, as well as the finished JavaScript code as found in complete.js. These files can be downloaded from the Packt Publishing web site at http://www.packtpub.com/support.
为了完成这些练习,你需要这一章的一个index.html文件,何忧在complete.js中的一根已经完成的js代码。这些文件可以从Packt Publishing 网站:http://ww.packtpub.com/support上下载下来。
Challenge exercises may require use of the official jQuery documentation at http://api.jquery.com/.
1. Add a class of specialto all of the <li>elements at the second level of the nested list.
2. Add a class of yearto all of the table cells in the third column of a table.
3. Add the class specialto the first table row that has the word Tragedyin it.
4. Challenge: Select all of the list items (<li>s) containing a link (<a>). Add the class afterlinkto the sibling list items that follow the ones selected.
5. Challenge: Add the class tragedyto the closest ancestor <ul>of any .pdflink.