Pseudo-code is probably the best way to show what I’m looking to do in jQuery:
$(selector).each(function() {
// pull data from LI tags or whatever, store in variables (imgURL, tagline, summary)
$someDataStructure.add({imgURL, tagline, summary});
});
Then later… reference the structure
$someDataStructure.each(function() {
var x = $someDataStructure['imgURL'];
// etc.
});
Any suggestions on how I could go about doing this?
jQuery is just JavaScript, and JavaScript has objects. You can use JS Objects similarly to a C++ map or C# Dictionary. For example, you can create an array of objects and have indices that you can name:
Then later: