开发者

If statement for jquery

开发者 https://www.devze.com 2023-02-07 20:54 出处:网络
How to make th开发者_开发技巧is right? $(this).click(function(){ if(showLarge == 1 && !$(\'.loginLarge_wrap\')){

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

精彩评论

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