I have the following Javascript code that works perfectly:
$(document).ready(function() {
$("#Select1").setDefault();
$("#Select2").setDefault();
$("#Select3").setDefault();
$("#Select4").setDefault();
$("#Select5").setDefault();
$("#Select6").setDefault();
});
Now, If I use the following compact code it doesn’t work:
$(document).ready(function() {
for(i=1; i<=6; i++){
$("#Select"+i).setDefault();
}
});
The for works fine if I write:
for(i=1; i<=6; i++){
alert(i);
}
Any idea?
PS: I use Chrome and Firefox
Loop code is missing the closing parenthesis… a
)Using a developer tool like Firebug will highlight these syntax errors for you. If you’re using Chrome hit F12 and you will have access to JavaScript console, etc, etc…