each function iterates through all of the elements matched by the selector - ie: the
div elements with the specified data attribute. It doesn't iterate over the descendants of the matched items, which is what you're trying to do.
You don't actually need to iterate over the descendants. You can just
find the relevant
span elements and update them directly:
var dRecord = $('div.cartRecord[data-cartID="' + _cartID + '"]');
Also worth noting that the return from the
$ function will never be
null. If there are no matching elements, you'll still get a jQuery object back, with a
length of zero.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."