I am trying to change the font-weight of an element. I tried with the following but it doesn't seem to work:
$("#opt_" + i).attr("font-weight", "bold");
Also what's the difference between prop and attr? Is that something to do with my problem?
use the .css() function instead of .attr()
$("#opt_" + i).css("font-weight", "bold")
It's not an attribute, but CSS:
$("#opt_" + i).css("font-weight", "bold");
example: http://jsfiddle.net/niklasvh/ENwbn/
$("#opt_" + i).style("font-weight", "bold");
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