Edit This Code:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("p").not($("div p.intro")).css("background-color", "yellow");
});
</script>
</head>
<body>

<div style="border:1px solid black;">
  This is a div element
  <h1>Welcome to My Homepage</h1>
  <p>My name is Donald.</p>
  <p class="intro">I live in Duckburg (this p element will be removed from the group).</p>
  <p>My best friend is Mickey.</p>
</div>

<p class="intro">This p element is outside the div element, and will not be removed.</p>
<p>This p element is also outside the div element.</p>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy