JSFiddle - React, Tailwind, and code Playground

by cgtrman

HTML

<textarea id="test" rows='16' style='width:500px;'>Name,<br /><br />Please print the files listed below.</textarea>

JavaScript

function replaceHtml(string_to_replace) {
    return $("<div>").append(string_to_replace.replace(/&nbsp;/g, ' ').replace(/<br.*?>/g, '&#13;&#10;')).text();
}

var str = $("#test").val();
$("#test").val(replaceHtml(str));