使用jQuery选择和操作CSS伪元素,例如:: before和:: after
问题: Is there any way to select/manipulate CSS pseudo-elements such as ::before and ::after (and the old version with one semi-colon) using jQuery? 有没有办法使用jQuery选择/处理CSS伪元素,例如 ::before 和 ::after (以及带有一个分号的旧版本)? For example, my stylesheet has the following rule: 例如,我的样式表具有以下规则: .span::after{ content:'foo' } How can I change 'foo' to 'bar' using jQuery? 如何使用jQuery将'foo'更改为'bar'? 解决方案: 参考一: https://stackoom.com/question/L9WQ/使用jQuery选择和操作CSS伪元素-例如-before和-after 参考二: https://oldbug.net/q/L9WQ/Selecting-and-manipulating-CSS-pseudo-elements-such-as-before-and-after-using-jQuery 来源: oschina 链接: https: