$(function(){
$('div').click(function(){
$(this).css('width')//只写一个值时候是获取属性值
$(this).css('width','10px')
//写两个时候是修改属性值
$(this).css({
width:400,
height:500,
background:'red'
})
//样式以对象修改时候 属性名不用引号 数字不用引号 非数字要添加引号
console.log($(this).css('width'))
})
})
jquery 1-4 CSS样式 笔记
最新推荐文章于 2024-08-20 19:23:57 发布