有没有办法使用jQuery 选择/操作CSS伪元素,如::before和::after(以及带有一个分号的旧版本)?
例如,我的样式表具有以下规则:
.span::after{ content:'foo' }
Run Code Online (Sandbox Code Playgroud)
如何使用jQuery将'foo'更改为'bar'?
我在HTML文档中有这个:
<a class="wbutton tint" data-tint="rgba(255,0,0,.5)" href="#">This should be red, with an opacity of 0.5</a>
Run Code Online (Sandbox Code Playgroud)
这在CSS文件中:
.window > .content .wbutton.tint {
border: solid thin attr(data-tint, color);
box-shadow: inset 0 0 50px attr(data-tint, color);
}
Run Code Online (Sandbox Code Playgroud)
Firefox在Firebug中返回CSS错误.难道我做错了什么?
根据该对W3C规范attr()功能,它应该工作.
(另外,在MDN Wiki中有一个页面attr(),所以我认为它至少应该在Firefox中工作)