$().arr使用

$("#handmoney").attr("readonly","readonly"); 只读
$("img").attr("width","180");设置图片宽度
$("img").attr({width:"50",height:"80"});设置宽和高
$("ul").attr("title","不吃橘子");
$("#accessory").css("display","none"); 隐藏
$("#accessory").css("display","block"); 显示
$("#handmoney").removeAttr("readonly"); 删除所有 #handmoney 元素的 readonly属性
$("p").hide(1000); 隐藏某段div

$(document).ready(function(){

$("button").click(function(){

$("#w3s").attr("href","http://www.w3school.com.cn/jquery"); 超链接

});
});

$(document).ready(function(){
$("button").click(function(){
$("#w3s").attr({
"href" : "http://www.w3school.com.cn/jquery/",
"title" : "W3School jQuery 教程"
});
});
});

$("#div1").remove() 删除div
$("#div1").empty(); 清空div内容
$("h1,h2,p").addClass("blue"); 给某个字体设置颜色
$("div").addClass("important"); 设置class 属性
$("h1,h2,p").removeClass("blue"); 删除元素
$("p").css("background-color","yellow"); 设置背景黄色
$("p").css({"background-color":"yellow","font-size":"200%"}); 背景黄色。字体加大

$("#div1").fadeOut();立即
$("#div2").fadeOut("slow");
$("#div3").fadeOut(3000); 3秒隐藏

时间: 2024-08-04 22:33:34