Javascript examples for jQuery Method and Property:filter
Filter selected elements by class and id
<!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").filter(".intro,#outro").css("background-color", "yellow"); });/*from w w w . j a va 2 s . c o m*/ </script> </head> <body> <h1>Welcome to My Homepage</h1> <p>test</p> <p class="intro">test</p> <p id="outro">test</p> <p>test</p> </body> </html>