开发者

If statement for jquery

How to make th开发者_开发技巧is right?

$(this).click(function(){
   if(showLarge == 1 && !$('.loginLarge_wrap')){
     //
   }
});

The idea here is that, there's a condition showLarge equals to 1 and not equals to .loginLarge_wrap

Thank you.


$(this).click(function() {
    if ( ( showLarge == 1 ) && ( showLarge != $('.loginLarge_wrap' ) ) ) {
        //
    }
});


You can use jQuery method - hasClass() to check to see if the class - '.loginLarge_wrap' is present instead of doing

showLarge != $('.loginLarge_wrap' )

Assuming showLarge is a DOM element. you can do something like this:

if($(showLarge).val() == 1 && (!$(showLarge).hasClass('.loginLarge_wrap')))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜