Id's should be unique in a document. You never need to include any other selector but the id itself $('#B')
. No need for .find
or anything - there's only one on the page anyway.
If you want a reference to the li
tags under #B
, here are two ways:
//get a reference to the list
var $B = $('#B');
//get children (which are lis)
var $lis = $B.children();
or just get the lis directly:
var $lis = $('#B li');