I want to preserve line break (input by Enter key) in the preview of mathjax dynamic , I try to do it by javascript (since I think they don't load jquery) replace
function, but failed with the hint that getElementById
returns a div
tag, not a string.
Any solution? Thanks!
I did the following test on a javascript console:
var text = document.getElementById('MathInput').value;
text = text.replace(/\r?\n/g, '<br />');
document.getElementById('MathPreview').innerHTML = text;`
text.replace(/(\r\n|\r|\n)/g, "<br />");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.