I've googled for the last two days and browsed this site, too, but found no similar problem. I am new to jQuery and hope this is no duplicate of other posts.
$(this).css("font-weight", "bold"); //this works
$(this).css({"font-weight":"bold"}); //this works as well
$(this).css("font-weight", "normal"); //this doesn't work
$(this).css({"font-weight":"normal"}); //this doesn't work either
Why is it that text font weight cannot be set to NORMAL (in my case)? I use Firefox 17.0.1, but the function to set the font to normal never works in an earlier version of Firefox as well.
UPDATED:
My problem was finally solved last night, after browsing this site and found quite a similar thing. A few folks had to search for <b> and </b> in an HTML snippet and I fixed my problem by
Using this:
"$(this).find('strong, b').css('font-weight', 'normal')"
Instead of:
"$(this).css('font-weight', 'normal')".
Problem solved! Thanks to everyone for lending me a hand yesterday.
Normat is working fine could you cross check which version of the jquery you are using? give the command so that we also can understand your problem
script
$("#div1").css("font-weight", "bold");
$("#div2").css("font-weight", "normal");
$("#div3").css("font-weight", "bold");
$("#div4").css("font-weight", "");
HTML
<div id="div1" >some text</div>
<div id="div2" >some text</div>
<div id="div3" >some text</div>
<div id="div4" >some text</div>
<input type="button" onclick="javascript:$('#div1').css('font-weight','normal')" value="Normal"/>
<input type="button" onclick="javascript:$('#div1').css('font-weight','bold')" value="Bold"/>
DEMO
The normal is also working for me but if you have problem, try setting the font-weight to empty string, It would apply default which would be normal.
Live Demo
$(this).css("font-weight", "");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With