I need to make some part of my string bold using the replace function. "b" and "strong" tags do not work within the string as "<" part of tag di
Supposing that you know the text to be put in bold... There is a JS string function bold().
This can help you...
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a string in bold.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var str = "Hello World!";
var result = "The " + str.bold() + " is in bold";
document.getElementById("demo").innerHTML = result;
}
</script>
</body>
</html>
Check: https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_str_bold