hi i am using jquery validator plugin , i saw annnotation like this
|=
what does this mean , i have never seen like that ,
this is code
// http://docs.jquery.com/Plugins/Validation/valid
valid: function() {
if ( $(this[0]).is('form')) {
return this.validate().form();
} else {
var valid = false;
var validator = $(this[0].form).validate();
this.each(function() {
valid |= validator.开发者_Go百科element(this);
});
return valid;
}
},
please help....................
var1 |= var2;
is the same as
var1 = var1 | var2;
|
is the bitwise OR operator
https://developer.mozilla.org/en/JavaScript/Reference/Operators/Bitwise_Operators
Some examples of ORing numbers:
1 | 1 => 1
1 | 2 => 3
1 | 3 => 3
1 | 4 => 5
It's a BitWise OR assignment operator
Similar to doing x = x | y
, it's the shorthand of that, x |= y
Reference: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Assignment_Operators
精彩评论