Javascript examples for jQuery Selector:parent child
Select LI under UL test
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("ul.test > li").css("border", "4px double"); });//w w w .j av a 2 s . c o m </script> </head> <body> <ul class="test"> <li>List item</li> <li>List item <ul> <li>Nested list item (will not have border)</li> </ul> </li> <li>List item</li> </ul> </body> </html>