有没有办法使用jQuery更改CSS类的属性,而不是元素属性?
This is a practical example:
我有一个第red
班的div
.red {background: red;}
我想更改类red
背景属性,而不是指定了类red
背景的元素.
如果我使用jQuery .css() method执行此操作:
$('.red').css('background','green');
它会影响到现在red
级的元素.到目前为止一切都很好.
I could call jQuery .css() method again. But I would like to know if there is a way to change the class itself. Please consider this is just a basic example.