Forum Moderators: open
I use the following piece of Javascript to validate my text fields and textareas.
-----
function validatedtxt(string) {
for (var i=0, output='', valid="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .,"; i<string.length; i++)
if (valid.indexOf(string.charAt(i))!= -1)
output += string.charAt(i)
return output;
}
-----
The only problems is, it removes line breaks in my textareas. Does anyone know how I can include the line breaks as valid?
Thanks,
ASPhopeful.