Use getComputedStyle() :
$('h1').each(function(){ console.log(window.getComputedStyle(this,':before').content); });
before() is the jQuery method used to move the DOM, it gets / sets the previous element, it does not access the pseudo-element.
JS working script provided by Eric .
Despite the unsuccessful warning, this approach returns the literal string used in the content declaration, not the actual generated content.
David thomas
source share