Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery "or" statement

Tags:

jquery

How do i use an "or" statement in jquery, i have two separate statements that i think i can combine to be just one:

$('li.members').hover(function() {
    $('.members-show').show();
    $('.brokers-show').hide();
    $('.providers-show').hide();
    $('.employers-show').hide();
    $('.seniors-show').hide();
    return false;
  });

$('li.members-active').hover(function() {
    $('.members-show').show();
    $('.brokers-show').hide();
    $('.providers-show').hide();
    $('.employers-show').hide();
    $('.seniors-show').hide();
    return false;
  });
like image 793
tony noriega Avatar asked Aug 10 '10 14:08

tony noriega


People also ask

Can you use if statements in jQuery?

The conditional loops that can be worked in a jQuery script are 'if' statement, 'if..else' statement, and 'if..else if' statement.

What is '$' in jQuery?

$ is pretty commonly used as a selector function in JS. In jQuery the $ function does much more than select things though. You can pass it a selector to get a collection of matching elements from the DOM. You can pass it a function to run when the document is ready (similar to body.

Is not condition in jQuery?

jQuery not() Method: This method returns elements that do not match a defined condition. This method specifies a condition. Elements that do not match the condition are returned, and those that match will be removed. Mostly this method is used to remove one or more than one elements from a group of selected elements.

How call jQuery function in if condition?

getElementById("title"). value; var flagu2=0; ..... ..... var flagu6=0; if( flagu1==0 && flagu2==0 && flagu3==0 && flagu4==0 && flagu6==0 ) return true; else return false; } function clearBox(type) { // Your implementation here } // Event handler $submitButton. on('click', handleSubmit); });


1 Answers

$('li.members, li.members-active').hover(function() {
    $('.members-show').show();
    $('.brokers-show').hide();
    $('.providers-show').hide();
    $('.employers-show').hide();
    $('.seniors-show').hide();
    return false;
  });
like image 72
Ryan Kinal Avatar answered Sep 28 '22 13:09

Ryan Kinal