Assuming there's only a handful of characters that might be at the beginning
of the test1 string, you could use a regular expression, like so:

        var test1 = 'a8';
        if (test1.match(/^[abcd]8/)) alert('true');

Run those two lines and you should get an alert box saying 'true'. Change
the a to a z, and you'll get nothing.


-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alfredo Alessandrini
Sent: Wednesday, November 19, 2008 9:49 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] newbies question


Hi,


Can I simplify this if statement?


 if (test1 == 'a8' || test1 == 'b8' || test1 == 'c8' || test1 == 'd8'
..........


I must select some values, the first is a letter and the second is a
number (always the number 8: a8, b8, c8, d8, ecc......)


Thaks in advance,

Alfredo


Reply via email to