Javascript examples for jQuery Selector:class
Select the paragraph with only specific class
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){/*from w ww . j a v a 2s . c om*/ $('p[class="p"]').css('color', 'red'); }); </script> </head> <body> <p class="p">Paragraph</p> <p class="p p2">Paragraph 2</p> <p class="p p3">Paragraph 3</p> </body> </html>