I am building a string to store in a text area using JavaScript and I want to bold certain values/text within the string. I've tried .bold()
and <b>
/<strong>
tags but they don't make the text bold. Instead, they display the tag.
Here is my code:
var msg = username.val() + " is requesting that the Custody of the credentialing record for " + last.val() + ", " + first.val() + " (" + identifierTxt.val() + ") be transferred to " + uicTxt.val() + ", " + mtfName.val() + " NLT " + custodyDate.val() + ". \n\n";
if (reasonId.val() == "") {
msg = msg + "Reason: <b>Reason Not Entered></b>"
}
else {
if (reasonId.val() == 99999) {
msg = msg + "Reason: " + $("#ReasonId option:selected").text() + " - " + otherReason.val() + "\n\n";
}
else {
msg = msg + "Reason: " + $("#ReasonId option:selected").text() + "\n\n";
}
}
msg = msg + "My contact information is as follows: \nUsername: " + username.val() + "\n";
if (email.val() == "") {
msg = msg + "Email: <b><Email Not Entered></b> \n";
}
else {
msg = msg + "Email: " + email.val() + "\n";
}
if (phone.val() == "") {
msg = msg + "Phone: <Phone Not Entered> \n";
}
else {
msg = msg + "Phone: " + phone.val() + " (" + phoneType.val() + ")\n\n";
}
msg = msg + "Credentials Coordinator: \nName: " + publicAffarsTxt.val() + " \nCommercial Phone: " + mtfPhone.val() + "\nDSN Phone: " + mtfDSN.val() + "\nFax Phone: " + mtfFax.val() + "\nEmail Address: " + mtfEmal.val();
$("#MessageTxt").val(msg);
}
I am using razor as well and my text area is: @Html.TextAreaFor(model => model.MessageTxt, new { @class = "form-control", @readonly = "readonly", @cols = 50, @rows = 15 })