Javascript examples for jQuery Selector:class
Select <p> elements with test class name
<!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>