Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <script src="../../ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("div").children("p").css("background-color","yellow"); }); </script> </head> <body> <p>This is a p element in body.</p> <div style="border:1px solid;"> <p>This is a p element (child of div).</p> <h4>This is a h4 element inside the div (child of div).</h4> <p class="child">This is a p element with class "child" (child of div).</p> <span>This is a span element (child of div).</span> <p>This is also a p element (child of div).</p> </div> <p>This is also a p element in body.</p> </body> <!-- Mirrored from www.w3schools.com/jquery/tryit.asp?filename=tryjquery_traversing_children4 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:15:55 GMT --> </html>
Result:
Try it Yourself - © w3schools.com