1、创建新 DOM 元素

  $('<div>Hello</div>');

  $('<img>', {
    src: 'images/little.bear.png',
    alt: 'Little Bear',
    title: 'I woof in yor general direction',
    click: function() {
      alert($(this).attr('title'));
    }

  }).appendTo('body');

2、操作 jQuery collection 对象的方法

  get([index])

    

    示例:$('img[alt]').get(0)

  eq(index)

    

    示例:$('img[alt]').eq(2)

  first()

    

    示例:$('img[alt]').first()

  last()

    

    示例:$('img[alt]').last()

  toArray()

    

    示例:$('img[alt]').toArray()

  index()

    

    示例:$(#main-menu > li').index($('#blog-link'));

  父子、祖先、子孙关系函数

    

  add() 

    

  not()

    

    示例,
    $('div').not(function(index) {

      // 注意,此处的 this 是一个 DOMElement 对象,而不是 jQuery 对象
      return $(this).children().length > 2;
    });

  filter()

    

    示例,

    $('td').filter(function() {

      // 注意,此处的 this 是一个 DOMElement 对象,而不是 jQuery 对象
      return this.innerHTML.match(/^\d+$/);
    });

    $('img').filter('[title*="dog"]').addClass('red-border');

  slice()

    

  has()

    

  map()

    

    示例,

    $('div').map(function() {

      // 注意,此处的 this 是一个 DOMElement 对象,而不是 jQuery 对象
      return this.id;
    });

  each()

    

    示例,

    $('img').each(function(index) {

      // 注意,此处的 this 是一个 DOMElement 对象,而不是 jQuery 对象
      return this.id;
    });

  is()

    

  end()

    

  addBack()

    

最新文章

  1. [PHP源码阅读]strtolower和strtoupper函数
  2. Excel VBA自定义函数编写(UDF, User-Defined Function)
  3. POJ 1984 Navigation Nightmare 带全并查集
  4. lua module package.seeall选项
  5. 配置eclipse集成开发环境_编译_调试
  6. C语言位操作(转)
  7. 实用的插件:跨浏览器复制jQuery-zclip
  8. Redis "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk"问题的解决
  9. find用法
  10. Scala中的元组
  11. [iOS]使用symbolicatecrash分析crash文件
  12. JQuery UI 封装了一些常用模板
  13. 梳理spring的层次结构的神器
  14. HTML&amp;javaSkcript&amp;CSS&amp;jQuery&amp;ajax(五)
  15. 前缀和的应用 CodeForces - 932B Recursive Queries
  16. 阿里八八Alpha阶段Scrum(6/12)
  17. 8.23 js
  18. php导出excel(xls或xlsx)(解决长数字显示问题)
  19. vue.js-列表分页
  20. C语言动态库和静态库的使用及实践

热门文章

  1. C#编写的通过汉字得到拼音和五笔码
  2. js根据className获取元素封装
  3. angular背景图片问题
  4. java 的SYSTEM类【转】
  5. jquery点击添加样式,再点击取出样式
  6. C# 分部类与分部方法
  7. mongo 查找附近点
  8. linq 对Sum()函数的支持
  9. hdu 2896 字典树解法
  10. C#十种语法糖