How to use Switch Case in jQuery

A switch works by comparing what is in switch() to every case.
[javascript]
switch (cnt) {
    case 1: ….
    case 2: ….
    case 3: ….
}
[/javascript]

works like:
[javascript]
if (cnt == 1) …
if (cnt == 2) …
if (cnt == 3) …
[/javascript]

Therefore, you can’t have any logic in the case statements.
[javascript]
switch (cnt) {
    case (cnt >= 10 && cnt <= 20): … } [/javascript]

works like [javascript] if (cnt == (cnt >= 10 && cnt <= 20)) …
[/javascript]

and that’s just nonsense. 🙂

Use if () { } else if () { } else { } instead.