$(this).css(“color”,“red”); 是给元素对象添加一组样式
也可以通过以下方式来给元素对象一次性添加多组样式,
但要遵从一个规则:如果是复合属性则采取驼峰命名法,如果不是数字则必须要加引号
$(this).css({
"color":"red",
"height":"300px",
"width":"300px",
"backgroundColor":"pink"
})
$(this).css(“color”,“red”); 是给元素对象添加一组样式
也可以通过以下方式来给元素对象一次性添加多组样式,
但要遵从一个规则:如果是复合属性则采取驼峰命名法,如果不是数字则必须要加引号
$(this).css({
"color":"red",
"height":"300px",
"width":"300px",
"backgroundColor":"pink"
})