Let’s say I have the following contrived example:
var allListItems = $('li');
...
doSomeStuff();
...
allListItems.css({color: blue});
now by the time the last line runs allListItems might no longer hold all the list items. Some might have been added to the DOM. Is there some way to force allListItems to recalculate?
I know I can do allListItems = $(allListItems.selector, allListItems.context) but is there something built in?
Nope, just do it again.
FYI: There is a convention that jQuery objects start with $:
var $allListItems = $(‘li’);