I'm setting the font-weight property with the following code:
$(this).css({ 'font-weight': 'normal' });
Now i want to check if an element has bold or normal font-weight propety, how do i do this?
I'm setting the font-weight property with the following code:
$(this).css({ 'font-weight': 'normal' });
Now i want to check if an element has bold or normal font-weight propety, how do i do this?
you can get it using:
fontWeight = $(this).css('font-weight')
To compare:
if (fontWeight == 'normal'|| fontWeight == '400')
//or
if (fontWeight == 'bold' || fontWeight == '700')
You can use:
if ($('#yourElement').css('font-weight') == 'normal') {
// Your code if font-weight is normal
} else if($('#yourElement').css('font-weight') == 'bold') {
// Your code if font-weight is bold
}