Javascript 引导获取图标代码
我的任务是从引导glyphicon元素(例如“\e020”)获取代码 我尝试了以下方法: html: 但在这里我只能实现字符本身,而不是原始代码Javascript 引导获取图标代码,javascript,twitter-bootstrap,twitter-bootstrap-3,glyphicons,Javascript,Twitter Bootstrap,Twitter Bootstrap 3,Glyphicons,我的任务是从引导glyphicon元素(例如“\e020”)获取代码 我尝试了以下方法: html: 但在这里我只能实现字符本身,而不是原始代码 有没有办法获取“\e020”的字符串?您可以使用toString方法和16参数将字符转换为十六进制: var content = window.getComputedStyle($('#glyph')[0], ':before').content var result = '\\' + content.charCodeAt(1).toString(16
有没有办法获取“\e020”的字符串?您可以使用
toString
方法和16
参数将字符转换为十六进制:
var content = window.getComputedStyle($('#glyph')[0], ':before').content
var result = '\\' + content.charCodeAt(1).toString(16);
alert(result);
请参见您可以使用
toString
方法和16
参数将字符转换为十六进制:
var content = window.getComputedStyle($('#glyph')[0], ':before').content
var result = '\\' + content.charCodeAt(1).toString(16);
alert(result);
看
var content = window.getComputedStyle($('#glyph')[0], ':before').content
var result = '\\' + content.charCodeAt(1).toString(16);
alert(result);