Home >Web Front-end >JS Tutorial >jquery gets the font-size attribute value implementation code_jquery

jquery gets the font-size attribute value implementation code_jquery

WBOY
WBOYOriginal
2016-05-16 17:20:521045browse
复制代码 代码如下:

var fontSize = $(this).attr('style',function(i,s){
return s.replace(/font-size:s*(d .{0,1}d*)/, function(a){
return a 'px';
});
});
//console.debug("font-size: " $(this).attr('style').match(/(?:font-size:)s*(d .{0,1}d*)/));

var style = $(this).attr('style');
var fontSize = $(this).css('font-size',function(){
var s = style.match(/(?:font-size:)s*(d .{0,1}d*)/)[0].replace(/font-size:/,'');
return s;
});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn