全部展开 | 全部折叠 | 速查表

返回值:jQueryjQuery.fn.extend(object)

概述

扩展 jQuery 元素集来提供新的方法(通常用来制作插件)。

查看这里<a href="http://docs.jquery.com/Plugins/Authoring" title="Plugins/Authoring">Plugins/Authoring</a>可以获取更多信息。

参数

objectObjectV1.0

用来扩充 jQuery 对象。

示例

描述:

增加两个插件方法。

jQuery 代码:
jQuery.fn.extend({
  check: function() {
    return this.each(function() { this.checked = true; });
  },
  uncheck: function() {
    return this.each(function() { this.checked = false; });
  }
});
结果:
$("input[type=checkbox]").check();
$("input[type=radio]").uncheck();