Select <p> elements with test class name - Javascript jQuery Selector

Javascript examples for jQuery Selector:class

Description

Select <p> elements with test class name

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
    $("p.test").css("background-color", "yellow");
});/*from   w w  w  . j ava  2  s. co  m*/
</script>
</head>
<body>

<h1 class="test">Welcome to My Homepage</h1>
<p class="test">This is a test.</p>
<p>This is a paragraph.</p>

<p class="test">This is a tag.</p>
<p>This is a paragraph.</p>

</body>
</html>

Related Tutorials