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();
// 使用 jQuery
jQuery("div p").hide();
// 使用其他库的 $()
$("content").style.display = 'none';
3、集合操作:
///获取选中的复选框:
$(“input[type=’checkbox’]”).prop(“checked”);
///禁止页面上所有的复选框:
$(“input[type=’checkbox’]”).prop({disabled: true});