1. 选择器  http://www.runoob.com/jquery/jquery-selectors.html

2. toggle()  用来切换 hide() 和 show() 方法   http://www.runoob.com/try/try.php?filename=tryjquery_toggle

http://www.runoob.com/jquery/jquery-hide-show.html

$(selector).toggle(speed,callback);

可选的 speed 参数规定隐藏/显示的速度,可以取以下值:"slow"、"fast" 或毫秒。

可选的 callback 参数是 toggle() 方法完成后所执行的函数名称。

3. 淡入淡出   fadeIn  fadeOut  fadeToggle  fadeTo        http://www.runoob.com/jquery/jquery-fade.html

4. 滑动   slideDown   slideUp  slideToggle     http://www.runoob.com/jquery/jquery-slide.html

5. 动画     http://www.runoob.com/jquery/jquery-animate.html

 $("div").animate({
left:'250px',
opacity:'0.5',
height:'150px',
width:'150px'
});
$("div").animate({
left:'250px',
height:'+=150px',
width:'+=150px'
});
$("div").animate({
height:'toggle'
});

6. 设置内容和属性  不止是值 可以是函数  http://www.runoob.com/jquery/jquery-dom-set.html

$("#test1").text("Hello world!");
$("#test2").html("<b>Hello world!</b>");
$("#test3").val("Dolly Duck");
$("#test1").text(function(i,origText){
return "Old text: " + origText + " New text: Hello world!
(index: " + i + ")";
}); $("#test2").html(function(i,origText){
return "Old html: " + origText + " New html: Hello <b>world!</b>
(index: " + i + ")";
});

attr() 方法也允许您同时设置多个属性

$("#w3s").attr({
"href" : "http://www.w3cschool.cc/jquery",
"title" : "W3Schools jQuery Tutorial"
});

jQuery 方法 attr(),也提供回调函数(不止是值也可以是函数)

$("#w3s").attr("href", function(i,origValue){
return origValue + "/jquery";
});

7. 添加元素

  • append() - 在被选元素的结尾插入内容
  • prepend() - 在被选元素的开头插入内容
  • after() - 在被选元素之后插入内容
  • before() - 在被选元素之前插入内容

8. 删除元素 http://www.runoob.com/jquery/jquery-dom-remove.html

  • remove() - 删除被选元素(及其子元素)
  • empty() - 从被选元素中删除子元素

过滤被删除的元素   $("p").remove(".italic");

9. 操作 CSS  http://www.runoob.com/jquery/jquery-css-classes.html

  • addClass() - 向被选元素添加一个或多个类
  • removeClass() - 从被选元素删除一个或多个类
  • toggleClass() - 对被选元素进行添加/删除类的切换操作
  • css() - 设置或返回样式属性

10. 设置多个 CSS 属性   http://www.runoob.com/jquery/jquery-css.html

$("p").css({"background-color":"yellow","font-size":"200%"});

11.  遍历父   http://www.runoob.com/jquery/jquery-traversing-ancestors.html

$("span").parents("ul");//返回所有 <span> 元素的所有祖先,并且它是 <ul> 元素
$("span").parentsUntil("div");//返回介于 <span> 与 <div> 元素之间的所有祖先元素

12. 遍历子孙   http://www.runoob.com/jquery/jquery-traversing-descendants.html

$("div").children("p.1");//返回类名为 "1" 的所有 <p> 元素,并且它们是 <div> 的直接子元素
$("div").find("span");//返回属于 <div> 后代的所有 <span> 元素
$("div").find("*");//返回 <div> 的所有后代

13. 遍历同胞  http://www.runoob.com/jquery/jquery-traversing-siblings.html

  • siblings()
  • next()
  • nextAll()
  • nextUntil()
  • prev()
  • prevAll()
  • prevUntil()

14. 添加过滤的遍历  http://www.runoob.com/jquery/jquery-traversing-filtering.html

$("div p").first();//选取首个 <div> 元素内部的第一个 <p> 元素
$("div p").last();//选择最后一个 <div> 元素中的最后一个 <p> 元素
$("p").eq(1);//选取第二个 <p> 元素(索引号 1)
$("p").filter(".intro");//返回带有类名 "intro" 的所有 <p> 元素
$("p").not(".intro");//返回不带有类名 "intro" 的所有 <p> 元素

15. toArray

//把 <li> 元素转换为数组,然后输出该数组元素的 innerHTML
$("button").click(function(){
x=$("li").toArray()
for (i=0;i<x.length;i++)
{
alert(x[i].innerHTML);
}
});

jQuery 笔记的更多相关文章

  1. jquery笔记之属性选择器 查找以某种条件开头的页面元素

    jquery笔记之属性选择器 查找以某种条件开头的页面元素 转载:http://www.blogbus.com/amyqiong-logs/78340326.html $("div[id]& ...

  2. Jquery笔记之第二天

    Jquery笔记之第二天 jQuery - 获取内容和属性 获得内容 - text().html() 以及 val() <script> $(document).ready(functio ...

  3. Jquery笔记和ajax笔记

    Jquery笔记:jQuery是一个JavaScript函数库,专为事件处理设计 1.jQuery的引入 <script text="type/javascript" src ...

  4. 前端:jQuery笔记

    前端:jQuery笔记 此系列文章乃是学习jQuery的学习笔记. Asp.net MVC Comet推送 摘要: 一.简介 在Asp.net MVC实现的Comet推送的原理很简单. 服务器端:接收 ...

  5. Python全栈之jQuery笔记

    jQuery runnoob网址: http://www.runoob.com/jquery/jquery-tutorial.html jQuery API手册: http://www.runoob. ...

  6. jQuery笔记之 Ajax回调地狱

    本次演示回调地狱: 模拟电影网站,判断用户是否为该网址的vip用户(最高权限为vip) 如果vpi就展示出vip电影,点击相应的电影显示出该电影的详细介绍 ---------------------- ...

  7. JQuery笔记汇总

    jQuery相关资料 官网: jQuery官网 在线API: jQuery在线API W3School:W3School-jQuery教程(中文版哦) 下载jQuery:jQuery各版本下载 jQu ...

  8. jquery笔记(基础知识)

    最近在学jquery,做点小笔记 语法: $(this).hide() - 隐藏当前元素 $("p").hide() - 隐藏所有 <p> 元素 $("p . ...

  9. 记录前台页面一些jQuery笔记

    不知不觉工作两个月了,在这两个月,我成长很快学的很多,刚开始的时候,很多问题不懂,很多技术不会,当然作为实习阶段,很多不会的问题我都会去请教别人,在这里得感谢那些帮助我的人,但是经常去问别人问题,首先 ...

  10. jQuery总结或者锋利的jQuery笔记二

    第三章  jQuery 中 DOM 操作 , 进入这一章,你必须先要有 选择器的基础, 最好是基本选择器 (id,class,*,div,p 组合等) ,  层次选择器(div ul),(div> ...

随机推荐

  1. hibernate AOP

    摘自:http://pandonix.iteye.com/blog/336873/ 此前对于AOP的使用仅限于声明式事务,除此之外在实际开发中也没有遇到过与之相关的问题.最近项目中遇到了以下几点需求, ...

  2. 基于linux 的2048

    在 debian 下写了一个 2048, 效果如下: 感兴趣的朋友可以在这里(http://download.csdn.net/download/kamsau/7330933)下载. 版权声明:本文为 ...

  3. notepad++ 输入中文无响应

    如果是win7,到用户文件夹 C:\Users\xxxxxxxx\AppData\Roaming\Notepad++ 里面的config.xml 删掉,然后重新打开,应该就可以了,  代价是会删除之前 ...

  4. SAP-设置显示表格格式

    在我们用SAP系统的过程中产看表格的时候,需要设置查看表格的格式,表格的格式主要包含两个方面: 1,表格的样式 在查看表格的时候点击[设置]-[用户参数] 勾选[ALV Grid display]就控 ...

  5. BZOJ 2456: mode 水题

    2456: mode Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/problem.php? ...

  6. StarlingMVC Framework 原理。。。

    向starlingmvc 中添加bean后..会根据Metadata标签,分别交给不同的Processor去处理...然后会执行每个bean的postConstruct函数.相当于初始化函数...可以 ...

  7. Metadata Lock原理4

     http://blog.chinaunix.net/uid-28212952-id-3400571.html    Alibaba  今天发生一个故障,MM复制结构(主备库),备库slave del ...

  8. PAT 1001

    Calculate a + b and output the sum in standard format -- that is, the digits must be separated into ...

  9. IP101A芯片默认物理地址(PHY Adress)确定

    转载:http://blog.csdn.net/ropai/article/details/6961157 根据IP101A的DataSheet,芯片的第9,10,12,13,15脚为PHYAD0~P ...

  10. 炼数成金hadoop视频干货03

    视频地址:http://pan.baidu.com/s/1dDEgKwD 着重介绍了HDFS 运行了示例程序wordcount,自己也试了一遍(用的伪分布式) 1.建立数据(和讲师的操作有些不一样,不 ...