jQuery not() by DOM object

Description

jQuery not() by DOM object

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(document.getElementById("intro")).css("background-color", "yellow");
});/*w  w w . jav  a 2  s  .  c  o  m*/
</script>
</head>
<body>

<h1>Welcome to My Homepage</h1>

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

</body>
</html>



PreviousNext

Related