Tuesday, August 01, 2006

Javascript - Strpping CrLf

2 comments:
I've just been hunting round the internet for this so I thought Id share! This is a simple function to remove the CrLf characters from a string (Handy if you're receiving HTML in a Javascript variable and you want a HTML <BR/> instead) .
Simply add the following to the end of your variable and all will be well!

.replace(/(\r\n)/g, "<br/>");

Read More