javascript - font awesome: retrieve css of pseudo element displays a small rectangle -
i trying retrieve css value of font awesome pseudo element. css:
.pe-icon--check:before { content: '\f00c'; }
i use query
var symb = window.getcomputedstyle($('.pe-icon--check').get(0), ':before').getpropertyvalue('content');
but result small rectangle
. value need \f00c
. please me fix this?
the below solution worked!!
var content = window.getcomputedstyle(document.queryselector('.pe-icon--check'),':before').getpropertyvalue('content');
function entityforsymbolincontainer(character) { var code = character.replace(/"/g, '').charcodeat(0); var codehex = code.tostring(16).touppercase(); while (codehex.length < 4) { codehex = "0" + codehex; } return "\\" + codehex + ";"; }
Comments
Post a Comment