jQuery not() by id and class

Description

jQuery not() by id and class

View in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("p").not(".intro, #outro").css("background-color", "yellow");
});//  ww w.  ja v  a2 s .c o m
</script>
</head>
<body>

<h1>Welcome to My Homepage</h1>

<p>This is a test.</p>
<p class="intro">I am from java2s.com.</p>
<p id="outro">CSS HTML.</p>
<p>This is another test.</p>

</body>
</html>



PreviousNext

Related