Javascript Code Converts Line Breaks to BR or Space
Simple One Line Javascript Code to Easily Convert Javascript Line Breaks \r or \n or \r\n to Either <br> or Space
Home
Short:
// convert line breaks to html line breaks BR str.replace(/(?:\r\n|\r|\n)/g, "
");
// convert line breaks to spaces st.replace(/(?:\r\n|\r|\n)/g, " ");
source code home