jQuery Tutorial Tutorials - jQuery :not() selector

:not() selector

The jQuery :not() selector selects all elements that do not match the given selector.

jQuery :not() selector Syntax

$(':not(selector)')

jQuery :not() selector Examples

Find all input elements that are not checked and hightlights the next sibling span.

<div><input type="checkbox" name="apple"><span>Apple</span></div>
<div><input type="checkbox" name="orange" checked="checked"><span>Orange</span></div>

<script>
    $('input:not(:checked) + span').css( 'background-color', 'aqua' );
</script>

Try now

Date:2019-08-18 02:10:58 From:www.Lautturi.com author:Lautturi