jQuery nextAll() select all after <p>

Description

jQuery nextAll() select all after <p>

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").nextAll().css("background-color", "yellow");
});//w  w  w. ja  va2  s . c  o  m
</script>
</head>
<body>

<p>This is a p element.</p>
<div>This is a div element.</div>

<p>This is a p element.</p>
<h4>This is a h4 element.</h4>
<h5>This is a h5 element.</h5>

<p>This is a p element.</p>
<span>This is a span element.</span>

</body>
</html>



PreviousNext

Related