I've been experimenting with adding attributes and styling to elements. Sometimes my code works perfectly fine, while other times it doesn't produce the desired output.
Here's an example of when it works:
$('.card-text')
.text((size_avg).replace(/G/,'B'))
.attr({
'data-html': "true",
'data-original-title': `<strong><u>Size: </u></strong> Number of Subscribers, <strong>`+ addCommas(Math.round(size_avg)) + `</strong>`
});
The resulting display is:
Size: Number of Subscribers, 11.5
Everything seems to be working as expected here.
However, in this instance:
$('.card-text')
.text(Math.round(act_sub).replace(/G/,'B'))
.attr({
'data-html': "true",
'data-original-title': `<strong>yoyoyo</strong>`
});
The output is just:
<strong>yoyoyo</strong>
I'm puzzled as to why my code isn't functioning properly the second time around. Any insights?