Sorry for that dumb question.
How can I use a condition for a case in the javascript switch-case language element?
Like in the example below, a case should match when the variable liCount
is <=5 and >0; however, my code does not work:
switch (liCount) {
case 0:
setLayoutState('start');
var api = $('#UploadList').data('jsp');
api.reinitialise();
break;
case (liCount<=5 && liCount>0):
setLayoutState('upload1Row');
var api = $('#UploadList').data('jsp');
api.reinitialise();
break;
case (liCount<=10 && liCount>5):
setLayoutState('upload2Rows');
var api = $('#UploadList').data('jsp');
api.reinitialise();
break;
case (liCount>10):
var api = $('#UploadList').data('jsp');
api.reinitialise();
break;
}
Thanks for any advice!
Question&Answers:os