jQuery基本用法
在DOM加载完成后就可以可以对DOM进行操作 $(function() { $("input").click(function() { console.log(this.value) }) }) //其实这个就是jq ready()的简写,他等价于: $(document).ready(function() { //do something }) //或者下面这个方法,jQuer的默认参数是:“document”; $().ready(function() { //do something }) 修改CSS $("#jessie").html("测试一下").css({ "color":"pink", "font-size":"30px", "border":"1px solid red" }).width(300).height(200) 基本选择器 //ID选择器 $("#first").css("background","blue") //标签选择器 $("div").css("background","blue") //类选择器 $(".hehe").css("background","blue") //交集选择器 ("#first,.hehe,#last").css("background","blue") //交集选择器 $("p.hehe").css(