有没有办法使用jQuery 选择/操作CSS伪元素,如::before和::after(以及带有一个分号的旧版本)?
例如,我的样式表具有以下规则:
.span::after{ content:'foo' }
Run Code Online (Sandbox Code Playgroud)
如何使用jQuery将'foo'更改为'bar'?
我的代码是:
p {
position: relative;
background-color: blue;
}
p:before {
content: '';
position: absolute;
left:100%;
width: 10px;
height: 100%;
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
请看这个小提琴:http://jsfiddle.net/ZWw3Z/5/
我想仅在伪元素(红色位)上触发click事件.也就是说,我不希望在蓝色位上触发click事件.