javascript - tag - jQuery if statement, syntax

jquery set title (4)

If you're using Jquery to manipulate the DOM, then I have found the following a good way to include logic in a Jquery statement:

$(selector).addClass(A && B?'classIfTrue':'');

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. `

It depends on what you mean by stop. If it's in a function that can return void then:

if(a && b) {
    // do something
    // "stop"

You can wrap jQuery calls inside normal JavaScript code. So, for example:

$(document).ready(function() {
    if (someCondition && someOtherCondition) {
        // Make some jQuery call.

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...