var
formerContent = window.getComputedStyle($(
‘.red‘
),
‘::before‘
).getPropertyValue(
‘content‘
); document.styleSheets[0].addRule(
‘.red::before‘
,
‘content: "‘
+ latestContent +
‘"‘
); document.styleSheets[0].insertRule(
‘.red::before { content: "‘
+ latestContent +
‘" }‘
, 0);
来源: http://www.bubuko.com/infodetail-2033485.html