This is a question based on an answer to another question.
Please see this:
Export to CSV using jQuery and html
Regarding the code text = $col.text();
if there is a CSS :before content, I get text = " "
, because the cell is
<td><div id="state" class="state-c"> </div></td>
but actually the generated HTML shows a string in that cell because of the CSS style:
.state-c:before {
content: "Confirmed";
}
I tried with:
text = $col.text();
if (text.length < 2) { // text.length is always longer than 2 except when is = " "
text = window.getComputedStyle($('#state')[0], ':before').content;
}
and many variations of this code like window.getComputedStyle($(col)[0], ':before').content;
, etc, but I can't find a way to make it work inside that code, while it works perfectly in other contexts.
Is it possible to get the the string of the CSS :before content in this described way?