Hello,
Recently I created a validation script for a form
that checks a textarea. The visitor is invited to
send a list of 25 words, with each word on a new
line.
Before I submit the list I run a test that checks
the length of each word. In order to do this I split
the content of the textarea to create an array of
words that I can loop through.
For the split I'm using the following code:
var entries = list.value.split("\n");
It works fine with me, but I'm wondering if this
will also work on Mac computers.
Or should I write something like:
if(navigator.appVersion.indexOf("Mac") != -1) {
var entries = list.value.split("\r");
} else {
var entries = list.value.split("\n");
}
Thanks,
Jos
(PS. I know that windows uses "\r\n" but that is
dealt with in the subsequent code).