jQuery Selector element select specific element with class

Description

jQuery Selector element select specific element with 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.intro").css("background-color", "yellow");
});//from  w  ww  .  j a va 2  s .c  om
</script>
</head>
<body>

<h1>Welcome to My Homepage</h1>
<p class="intro">This is a test.</p>
<p>I am from java2s.com.</p>

<p class="intro">My name is Dolly.</p>
<p>I am from java2s.com.</p>

</body>
</html>



PreviousNext

Related