您的位置:首页 > Web前端 > JQuery

jQuery基础教程-第2章练习

2013-02-18 17:58 148 查看
02.js

$(document).ready(function() {
//Find the 2nd li add the "special" class
//Answer 1
$('li').children().find('li').addClass('special');

//Find the 3nd cell add the "year" class
//Answer 2
$('tr').find('td:eq(2)').addClass('year');

//Find first line of text containing "Tragedy" add the  the "special" class
//Answer 3
$('td:contains(Tragedy)').first().parent().addClass('special');

//Answer 4
//$('a').parent().nextAll().addClass('afterlink');
$('li').not('a').addClass('afterlink');

//Answer
$('a[href$=".pdf"]').closest('ul').addClass('tragedy');
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: