BruceyBandit
BruceyBandit

Reputation: 4324

How to display this jquery as bold

Simple question which I cannot actually figure out how to solve, how can I make .text(totalweight) to be displayed as bold?

Below is the code:

$("#total-weight").text(totalweight).append('%');

Thanks

Upvotes: 1

Views: 1293

Answers (2)

Matt Lacey
Matt Lacey

Reputation: 8255

This should do the trick for you:

$("#total-weight").text(totalweight).append('%').css('font-weight', '700');

As Moak has also shown, you can use bold as the value for font-weight, though using a number offers more precise control. w3schools has more information, and explains why I used 700 for the value.

Upvotes: 1

Moak
Moak

Reputation: 12865

$("#total-weight").css({fontWeight:'bold'}).text(totalweight).append('%');

for just the number:

$("#total-weight").html('<b>'+totalweight+'</b>').append('%');

Upvotes: 2

Related Questions