children() hanya memeriksa satu tingkat anak langsung, sedangkan find('*') mencari ke seluruh kedalaman keturunan.
jQuery Descendants
Contoh Kode jQuery jQuery Descendants:
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
</head>
<body style="font-family: sans-serif; padding: 20px;">
<ul id="menuNav">
<li><span>Beranda</span></li>
<li><span>Tutorial</span></li>
</ul>
<button id="btnFind">Cari Semua Span di Menu</button>
<script>
$('#btnFind').click(function() {
$('#menuNav').find('span').css('color', '#00758f');
});
</script>
</body>
</html>
Uji interaksi jQuery di atas dan amati animasi efek DOM secara langsung.