Reputation: 4150
I need get li
from a variable that contains ul
which was previously received :
var previousPage= $( "ul" );
$(previousPage 'li') //Doesn't work
How can I do?
Upvotes: 0
Views: 407
Reputation: 8728
Do it with the second parameter of $-method like this
var previousPage=$( "ul" );
$('li', previousPage);
This parameter specifies the context to search for the 'li'-tag...
And if you want the first li
do this:
$('li', previousPage).first();
You can also combine the selectors like this:
$(previousPage.selector +' li');
Upvotes: 3