Select <p> elements who has specific class name - Javascript jQuery Selector

Javascript examples for jQuery Selector:element

Description

Select <p> elements who has specific 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   ww w .j ava  2s  .co m*/
</script>
</head>
<body>

<h1>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