javascript - Error in switch() case; -


while i'm trying write simple function need iterate through classes of event.target , depending of class name, i've encountered unknown error (as me).

function tpager() {     var lc = $(event.target).attr('class');     swith(lc) {         case ('slow'):              console.log('slowclicked');              break;         case ('page'):              console.log('pageclicked');              break;     } }; 

this testing purposes, console "unexpected token", there error in line 3, "{". can't what's wrong.

jsfiddle: http://jsfiddle.net/2cjhc/

wouldn't code this

switch(lc) { // note keyword switch    case 'slow':        console.log('slowclicked');        break;    case 'page':        console.log('pageclicked');        break; } 

you're having this

swith(lc) { // not switch keyword. 

the mistake actual, @ keyword usage. having wrong keyword triggering mistake. change it, , go!


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -