改行をBRタグへ
1 2 3 4 5 6 |
function cr2br(val) { val = val.replace(/\r\n/g, '<br/>'); val = val.replace(/\n/g, '<br/>'); val = val.replace(/\r/g, '<br/>'); return val; } |
BRタグを改行へ
1 2 3 |
function br2cr(val) { return val.replace(/<br\/>/g, '\r\n'); } |