Using JS Methods in jQuery
Posted
by
Wasabi
on Stack Overflow
See other posts from Stack Overflow
or by Wasabi
Published on 2011-03-03T15:20:28Z
Indexed on
2011/03/03
15:24 UTC
Read the original article
Hit count: 155
jQuery
In the following code snippet, the String.fromCharCode is used, can all JS methods be used within jQuery?
Perhaps a noob question, but better to ask and prove a noob, then assume and be a fool.
// Invoke setBodyClass when a key is pressed
$(document).keyup(function(){
switch (String.fromCharCode(event.keyCode)){
case 'D':
setBodyClass('default');
break;
case 'N':
setBodyClass('narrow');
break;
case 'L':
setBodyClass('large');
break;
}
});//end keyup
© Stack Overflow or respective owner