I am probably going about this all wrong, but I’m not sure how to do this.
Basically I need to create a unique variable name for each element that has the same class name and set each one to zero.
I thought I could just concatenate the index value to a variable name to create unique names. Something like:
$(‘.toggle-trigger’).each(function(){
var toggleTriggerIndex = $(‘.toggle-trigger’).index(this);
var t + toggleTriggerIndex = 0;
});
But apparently that’s not possible. Anyone want to point me in the right direction?
btw, all I’m trying to do is have unique variables so I can give an open/closed state to each element that uses slideToggle, so I can manipulate a plus/minus graphic.
Thanks