I want to know whether it is possible to get a DOM element\'s ::before
content, which was set by CSS3.
I have tried some ways, but I still can\'t make it, s
Pass ":before"
as the second parameter to window.getComputedStyle():
console.log(getComputedStyle(document.querySelector('p'), ':before').getPropertyValue('content'));
p::before,
p::after {
content: ' Test ';
}
<p>Lorem Ipsum</p>
getComputedStyle(document.querySelector('span.search-box'), '::after').getPropertyValue('content');