学习笔记:《jQuery基础教程》第四版第二章课后练习
2015-10-08 19:48
567 查看
最近抽时间系统的学习下jQuery相关知识,看看《jQuery基础教程》。顺便把课后练习的代码整理发上来看看。
给位于嵌套列表第二个层次的所有
给位于表格第三列的所有单元格添加year类;
为表格中包含文本Tragedy的第一行添加special类;
*挑战:选择包含链接(
挑战:为与.pdf链接最接近的祖先元素
效果请点击
给位于嵌套列表第二个层次的所有
<li>元素添加special类;
给位于表格第三列的所有单元格添加year类;
为表格中包含文本Tragedy的第一行添加special类;
*挑战:选择包含链接(
<a>)的所有列表项(
<li>元素),为每个选中的列表项的同辈列表项元素添加afterlink类;
挑战:为与.pdf链接最接近的祖先元素
<ul>添加tragedy类
$(document).ready(function() { $('#selected-plays > li > ul > li').addClass('special'); //$('#selected-plays ul > li').addClass('special'); //$('#selected-plays ul ul > li').removeClass('special'); $('tr').find('td:eq(2)').addClass('year'); $('td:contains(Tragedy)').parent().filter('tr:eq(0)').addClass('special'); //$('tr:contains(Tragedy)').filter('tr:eq(0)').addClass('special'); //$('a').parent().parent().children().not('li:has(a)').addClass('afterlink'); $('a').parent().siblings().not('li:has(a)').addClass('afterlink'); console.log($('#email').parent().siblings()); $('a[href$=".pdf"]').parents('ul:eq(0)').addClass('tragedy'); });
效果请点击
相关文章推荐
- jQuery 遍历ul li 添加 移除
- jquery的ajax方法
- jquery删除动态增加的li
- JQuery中两个ul标签的li互相移动实现方法
- jquery倒计时功能
- jquery特效(1)—点击展示与隐藏全文
- java 跨越访问 (jquery,jsonp)
- jquery cookie控制过期时间解决方案
- jquery 让滚动条处于div底部
- Qrcode生成二维码(logo篇)之jquery.qrcode.min.js
- jquery应用 php和html交互
- jQuery ajax loading
- jQuery ——Ajax
- [从jQuery看JavaScript]-匿名函数与闭包(Anonymous Function and Closure)【转】
- 好用的JQ图片特效jquery-poptrox-popup-galleries
- JQuery插件使用小结
- jquery选择器总结 转自(永远的麦子)
- jQuery Mobile 高级设计模板
- 使用jquery获取ul的li的值赋值
- jquery自动创建表格