var options = {
fieldsToValidate : {},
slideDowns : {
0: '#address-phone-block',
1: '#zip-dob-block',
2: '#nextButton'
},
continueButton: "#continue-button",
landingForm: '#landingForm'
}
for (var slider in options.slideDowns[]){
console.log('did this work?' , slider , options.continueButton[slider])
$(options.continueButton[slider]).slideDown();
}
When the console logs i get this output, and then this error on the jQuery selector:
did this work? 0 #
"Syntax error, unrecognized expression: #"
I know that slider is 0/1/2 so why is this giving me the first character of the first property?
As
options.continueButtonisStringwith ‘#continue-button‘ value, sooptions.continueButton[0]is its first character, which is ‘#‘.Probably you need to use
options.slideDownsinstead ofoptions.continueButton, as you are looping through its properties: