1、jquey各个版本下载地址
http://www.jq22.com/jquery-info122
2、js在线手册:
http://www.jq22.com/chm/jquery/index.html
基础:
//设置元素样式
$("#done").css("background", "black");
$(document).ready(function () { });
$(function () { });
// each循环
$("img").each(function () {
$(this).toggleClass("example");
});
// jQuery 对象中元素的个数
$("img").size();
$("img").length;
// 取得其中一个匹配的元素。 num表示取得第几个匹配的元素
$("img").get(0);
$("img").get().reverse();
//index()
$("ul").index('li');
// 在元素上存放数据, 返回jQuery对象
$("div").data('biah', 'hello');
// 扩展 jQuery 元素集来提供新的方法(通常用来制作插件)
jQuery.fn.extend({
check: function () {
return this.each(function () {
this.checked = true;
})
},
uncheck: function () {
return this.each(function () {
this.checked = false;
})
}
});
$(function () {
$("input[type=checkbox]").check();
$("input[type=radio]").uncheck();
});
// =========属性
$("img").attr("src", "one.jpg");
$("img").attr({ "src": "one.jpg", "src": "one.jpg" });
// prop()、 removeProp()
$("input[type=checkbox]").prop("checked");
// addClass()、removeClass()
$("p").addClass("pclass");
// toggleClass()
$("p").toggleClass("selected");
// html()
$('p').html();
//text() 取得所有匹配元素的内容
$('p').text();
// val() 获得匹配元素的当前值
$("input").val();