Adds class to all divs that have a paragraph inside of them.
<html> <head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("div:has(p)").css("color","red"); }); </script> </head> <body> <body> <div><p>Hello in a paragraph</p></div> </body> </html>