现在document的操作也很方便了,jquery用的很少,记录以下备忘
一、获取css属性
$("p").css("background-color");
二、设置单个css属性
$("p").css("background-color","yellow");
三、设置多个csss属性
$("p").css({"background-color":"yellow","font-size":"20px"});
四、还可以
var showType = {
display: 'block',
position:'absolute',
top:'23px'
};
$("#IdName").css(showType);
五、添加移除属性
//两种方法设置disabled属性
$('#IdName').attr("disabled",true);
$('#IdName').attr("disabled","disabled");
//三种方法移除disabled属性
$('#IdName').attr("disabled",false);
$('#IdName').removeAttr("disabled");
$('#IdName').attr("disabled","");
网友评论