Home >>jQuery Tutorial >jQuery :not() Selector
jQuery :not() selector in jQuery is used to selects all elements except the specified element.
Syntax:$(":not(selector)")
Parameter | Description |
---|---|
selector | It is a Required parameter and used to specifies the element to not select. |
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p:not(.txt)").css("background-color", "Orange");
});
</script>
</head>
<body>
<h1>Welcome to Phptpoint</h1>
<p class="txt">My name is Phptpoint</p>
<p>I live in Noida.</p>
<p>Who is your favourite:</p>
<ul id="choose">
<li>JAVA</li>
<li>jquery</li>
<li>Javascript</li>
</ul>
</body>
</html>
My name is Phptpoint
I live in Noida.
Who is your favourite: