Assuming the “Badge Name: ” phrase is constant, one approach is using CSS :before
pseudo element to generate the content as follows:
.tag:before {
content: "Badge Name: ";
font-weight: bold;
}
Hence you could remove that phrase from your script:
wrapper.append('<div class="tag" >'+ item.badgename + '</div>'+ '<br>');
Another option is wrapping that phrase by an inline wrapper (a <span>
element) and use .tag span
selector to apply the proper declarations:
wrapper.append('<div class="tag" >'+ '<span>Badge Name:</span> '+ item.badgename + '</div>'+ '<br>');
2
solved How to target certain text to make bold using css