"earl" <b@email.com> writes:
arrDate = date.split('/');
How can I check if each array element contain only numeric values ?
I assume you want them to be non-empty too (the empty string contains
only digits, all zero of them).
I would test before splitting, so you can get away with only one test.
If you know there must be exactly three parts, then try this:
if (!(/^\d+\/\d+\/\d+$/).test(date)) {
// error.
}
If you accept any number of parts, then
if (!(/^\d+(\/\d+)*$/).test(date)) {
// error.
}
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'