.is() - use AND instead of OR condition

jquery

Solution

That comma in your selector is equivalent to an OR.

Use both conditions without a comma separating them inside `is()`

if ($('#search-form #valid_only').is(':checked:enabled') { // checked and enabled
    ...
}

Or if you want to check for `:checked`, `:enabled` and having a class name `foo`, you can do `.foo:checked:enabled`

Problem

At the moment, the result of `.is()` will return true if ANY (OR) of the conditions are `true`, how do I make it use AND instead, i.e. only return `true` if ALL conditions are met? ``` if ($('#search-form #valid_only').is(':checked, :enabled')) { } ```

Original source