Please consider the code below.
Here are what I need to happen:
1.) The html tag from variable msg_raw
will be rendered as plain html.
2.) The html tag from variable message
will be applied, which would mean that the output display will have a red colored ABC
text and blue colored <b>DEF</b>
text, like so:
ABC <-- red colored text
<b>DEF</b> <-- blue colored text
var msg_raw = '<b>DEF</b>';
var message = '<div class="red_text">ABC</div>';
message += '<div class="blue_text">' + msg_raw + '</div>';
$('#some_ID').html(message);
.red_text{ color: red; }
.blue_text{ color: blue; }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="some_ID"></div>