I have this php simple if condition:
if ( $myvar == '2' || $myvar == '6' || $myvar == '10'){}
How can I write this in jquery?
Ty!
I did it like this:
if (jQuery.inArray(2,6,10)) { do something }
Ty guys!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With jQuery:
But if you stop and remember that jQuery is a library of JavaScript functions and not a language on its own then presumably what you really want is to do it in JavaScript in which case the code from the question is actually valid JS too (once the closing quotation mark is added to
'10):