I want to dynamically set the text of a p
element with styling, but I do not know how to do this.
Here is my HTML element: <p id="delete-speaker-info-message"> </p>
Here is my current code to set the text:
document.getElementById("delete-speaker-info-message").innerHTML = `Are you sure you want to delete <b>${speakerName}</b> from <b>${eventName}</b>? This cannot be undone.`
Although the code above works, the speakerName, and eventName values are user inputted and need to be escaped. I know innerText can do this but it also escapes the bold tags. I am sure there is a way to do this but I just could not find it online. Thanks for the help!