$("#btntest").on( //不支持動態添加的元素
{click:function(){
$(this).attr("disabled","true");
},
mouseout:function(){
$(this).attr("disabled","true");
}}
);
{click:function(){
$(this).attr("disabled","true");
},
mouseout:function(){
$(this).attr("disabled","true");
}}
);
2014-11-09
$("body").on("click mouseout","#btntest",function(){ //支持動態添加的元素
$(this).attr("disabled","true");
});
$(this).attr("disabled","true");
});
2014-11-09
$("#content").css({"color":"white","background-color":"#98bf21"});
$("#content").css("background-color","Red");
$("#content").css("background-color","Red");
2014-11-09
css()包括如下4種用法:
$(selector).css({property:value, property:value, ...}) //多個CSS屬性/值對
$(selector).css(name,function(index,value)) //通過函數設置屬性值
$(selector).css(name,value)
$(selector).css(name) //獲取屬性值
$(selector).css({property:value, property:value, ...}) //多個CSS屬性/值對
$(selector).css(name,function(index,value)) //通過函數設置屬性值
$(selector).css(name,value)
$(selector).css(name) //獲取屬性值
2014-11-09
從 jQuery 1.7 開始,不再建議使用 .live() 方法。請使用 .on() 來添加事件處理。使用舊版本的用戶,應該優先使用 .delegate() 來替代 .live()。--源自w3school的說明
2014-11-08