jquery的积累

来源:互联网 发布:理光mpc3300端口设置 编辑:程序博客网 时间:2024/05/22 17:23

1、拓展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();

2、多库共存:$

jQuery.noConflict();// 使用 jQueryjQuery("div p").hide();// 使用其他库的 $()$("content").style.display = 'none';

3、集合操作:
///获取选中的复选框:
$(“input[type=’checkbox’]”).prop(“checked”);

///禁止页面上所有的复选框:
$(“input[type=’checkbox’]”).prop({disabled: true});

0 0
原创粉丝点击