Javascript examples for jQuery:Selector
Add a red color to all <p> elements that do not have the class name "intro".
<!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").not(".intro").css("color", "red"); });//from w w w . ja v a 2 s.com </script> </head> <body> <p>First paragraph.</p> <p class="intro">Second paragraph.</p> <p class="intro">Third paragraph.</p> <p>Last paragraph.</p> </body> </html>