tags:

views:

95

answers:

5

I understand in jQuery (or JavaScript for that matter) if you want to link conditions together you can say:

if (A && B) { do something }

But how do I implement an OR uch as:

if (A OR B) { do something }
+2  A: 
if (A || B) { do something }
Dolbz
+2  A: 

Use the || operator.

Skilldrick
+3  A: 

simply use doublepipe that is ||

luca
+1  A: 

|| is the or operator.

if(A || B){ do something }
rosscj2533
+1  A: 

Worth noting that || will also return true if BOTH A and B are true.

In javascript, if you're looking for A or B but not both, you'll need to do something similar to:

if( (A && !B) || (B && !A) ) { ... }

patrick dw