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>
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>