Hi all,
I'm fairly new to jQuery, and think I might be making something harder than it needs to be. I've got a jQuery variable that is just an unordered list. It was declared this way:
var $list = $('#activityList'); // activityList is ID of <ul>
I'm trying to select all <li>
elements within that list using the variable I've created:
$items = $('#' + $list.attr('id') + ' > li');
Does anyone know if there's a different syntax to achieve the same thing without having to break the variable down to it's id attribute?
Thanks.
Clarification: I used simplified code for the purposes of asking the question, but I do want to make use of the jQuery variable "$list" within the selector, rather than hardcoding the ID.