I have a straightforward question. I am attempting to include a style attribute in an HTML code that is in string format. I am passing the HTML code as a string through a method, and later I need to apply CSS to it based on certain conditions.
I attempted:
"<div style='background-color: red'>'Some data'</div>" // no success
"<div style="background-color: red;">'Some data'</div>" // no success
Eventually:
if(somethingMatches){
data = data.replace('something', "<mark style='background-color: red;'>" + 'something' + "</mark>")
}
Is there any way for me to make this work...