Javascript – jQuery if statement, syntax


What is a simple jQuery statement that states an operation proceeds only if A and B are true? If A isn't true, stop. If A and B are true, then continue.

Best Solution

jQuery is just a library which enhances the capabilities of the DOM within a web browser; the underlying language is JavaScript, which has, as you might hope to expect from a programming language, the ability to perform conditional logic, i.e.

if( condition ) {
    // do something

Testing two conditions is straightforward, too:

if( A && B ) {
    // do something

Dear God, I hope this isn't a troll...