1 2 3 4 5 6 7 8 9 10 11 12
| <style> #a::after { content: attr(data-info); color: red; } </style> <div id="a" data-info="foo"></div> <script> var div=document.querySelector('#a'); var color =window.getComputedStyle(div,'::after').getPropertyValue('color'); document.styleSheets[0].insertRule("#a::after {color: green; }", 1); </script>
|