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. oracle中的数据读取与查找

    数据读取 首先数据块读入到Buffer Cache中,并将其放在LRU(Last Recently Used)链表的MRU(Most Recently Used)端,当需要再次访问该块时可以直接从bu ...

  2. 【转】web测试内容及工具经典总结

    基于Web的系统测试在基于Web的系统开发中,如果缺乏严格的过程,我们在开发.发布.实施和维护Web的过程中,可能就会碰到一些严重的问题,失败的可能性很大.而且,随着基于Web的系统变得越来越复杂,一 ...

  3. 2015南阳CCPC A - Secrete Master Plan 水题

    D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Master Mind KongMing gave ...

  4. c#代码实现GPS数据的有效性校验

    用于校验GPS报文指令的有效性 很简单的代码,留存吧 public static bool Verify(string gpsInfo)         {            if (gpsInf ...

  5. leetcode || 53、Maximum Subarray

    problem: Find the contiguous subarray within an array (containing at least one number) which has the ...

  6. [Codeforces] 347B - Fixed Points

    题意:给定一个序列,现有一种操作:两个数的位置互换.问最多操作一次.序列 [元素位置i]  与 [元素Ai] 相等的最多个数? 依据题意,最多个数为 : [操作之前[元素位置i]  与 [元素Ai] ...

  7. [React] Styling React Components With Aphrodite

    Aphrodite is a library styling React components. You get all the benefits of inline styles (encapsul ...

  8. android145 360 进程管理

    package com.itheima.mobileguard.activities; import java.util.ArrayList; import java.util.List; impor ...

  9. [Effective C++ --028]避免返回handles指向对象内部成分

    假设程序涉及矩形.每个矩形由其左上角和右下角表示.为了让Rectangle对象尽可能小,可能把定义矩形的点放在一个辅助的struct内再让Rectangle去指它: class Point { // ...

  10. Windows下用Eclipse搭建C/C++开发环境

    本文假定你已经熟悉Java,Eclipse的安装,并能顺利启动和运行Eclipse.此外因为各软件版本在不断更新,有些地方可能不准确,以最新的.原文资料为准. 距上一次写和调C++程序,已经5.6年了 ...