20140821_JQUERY学习日记 attr()
2014-08-21 11:32 sunny_fan 阅读(133) 评论(0) 收藏 举报1.attr(attribute)
$("img").attr("width"); //取img标签中width属性值
2.attr(attribute,value)
$("#abc").attr("placeholder", ""); //将abc对象的placeholder赋值为空
3.attr(attribute,function(){})
$("img").attr("width",function(n,v){
return v-50;
}); //根据值处理
$("button").click(function(){
$("img").attr("width",function(n,v){
return parseInt(v)+50;
});
alert($("img").attr("width"));
});
浙公网安备 33010602011771号