In my .NET C#/Aspx web application, users fill out fields and the resulting form is sent via email. A new requirement has come up to allow users to highlight text and apply formatting such as bold or color.
After some research online, it seems that using JavaScript might be the most suitable option for this task. However, I encountered an issue where the inserted HTML tags do not render within the textbox. I understand that this is a limitation of the ASP.NET textbox, but I'm wondering if there's a way around this?
<script type="text/javascript">
function formatText(tag) {
var selectedText = document.selection.createRange().text;
if (selectedText != "") {
var newText = "<" + tag + ">" + selectedText + "</" + tag + ">";
document.selection.createRange().text = newText;
}
}