jQuery not Method


jQuery “not()” is used to remove the element from set of the matched elements. We have explained not method in jQuery with example and demo. Lets check out syntax of jQuery not Method and try it with our live editor.


Syntax : jQuery not() method

Here is syntax for jQuery not Method –

$(selector).not(criteria,function(index));

Criteria : Is selector expression, jQuery object or element which is removed from matched element.
function : Runs for each element and returns true if the element is removed from the set.

jQuery not Method Example with Editor

Here is an example with demo try it to test the functionality of the not method-

jQuery not() Method – Example

<script type="text/javascript">
         $(document).ready(function(){ 
              $( "#notExample" ).on( "click", function(event) {             
                 $(".remove-not").not(".remove-yellow-one,.remove-green-one,.remove-blue-one").css("border","2px solid red");
              });
               
          });
</script>

Try it »

The above example will produce the following output as below –

jQuery not Method


User Ans/Comments

📖 Read More


Advertisements