function nl2br(string){
  return string.replace(/\n/g,'<br/>').replace(/\r/g,'<br/>').replace(/\r\n/g, '<br/>');
}

Comment