I have the following loop:
for(var myScreen in wizardScreens){
if(step==index)$(myScreen).show();
else $(myScreen).hide();
index++;
}
wizardScreens is defined as $(".wizardScreen", wizard);, where wizard is a DOM element. Within the loop, myScreen is set to a string, instead of being a DOM element. Can anyone explain why that is happening?
jQuery collections already have a built-in iteration function:
Or perhaps even better for your use:
Which avoids explicit iteration altogether.