Reputation: 618
I'm trying to make text (fat) bold. Curretly I managed to do this whit code below:
Movie <b>fat</b> was been added
But this bold tags won't work. Now the question is how to enable html for only (fat), to be bold like this: Movie
fat was been added
My code so far:
var boldy = (Movie[0].title)
var fat = boldy.bold()
$("div.container div:first").text("Movie " + (fat) + " was been added")
I also tried whit this:
$("div.container div:first").html("Hello <b>"+(boldy)+"</b>")
Upvotes: 1
Views: 6031
Reputation: 3040
var html = $("div.container div:first").html;
$("div.container div:first").html(html.replace(/fat/gi, '<strong>$& </strong>'));
Upvotes: 0
Reputation: 4368
var word ="fat"
$("div:first").html("Movie <b>"+word+"</b> was been added")
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div></div>
Upvotes: 4
Reputation: 9988
var world = 'world';
$("div").html(`Hello <b>${world}</b>`);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
Movie fat was been added
</div>
Upvotes: 1
Reputation: 25
You can use the following:
$("div.container div:first").css("font-weight","Bold");
That will change the property font-weight from that div to bold.
@EDIT: You can make a div with an ID and set that ID on the jQuery mention:
$("div.container div:first div#text").css("font-weight","Bold");
Upvotes: 1