Получите детей jQuery
var count = $("#selected ul").children().length;
RedBredren
var count = $("#selected ul").children().length;