:not() Selector

not selector

version added: 1.0jQuery(':not(selector)')

  • selector
    A selector with which to filter by.

Description: Selects all elements that do not match the given selector.

All selectors are accepted inside :not(), for example: :not(div a) and :not(div,a).


Finds all inputs that are not checked and highlights the next sibling span. Notice there is no change when clicking the checkboxes since no click events have been linked.

<!DOCTYPE html>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  <input type="checkbox" name="a" />

  <input type="checkbox" name="b" />

  <input type="checkbox" name="c" checked="checked" />

  $("input:not(:checked) + span").css("background-color", "yellow");
  $("input").attr("disabled", "disabled");