Reputation: 1591
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
Upvotes: 2
Views: 84
Reputation: 42845
can all JS methods be used within jQuery?
Yes. jQuery is a library, not a replacement language.
Upvotes: 1
Reputation: 268512
jQuery is Javascript, so you may use any type of Javascript logic with jQuery.
Upvotes: 3
Reputation: 1075925
can all JS methods be used within jQuery
Yes. jQuery is just a library of JavaScript functions.
Upvotes: 2
Reputation: 35319
Yes since jQuery IS JavaScript any and all JavaScript can be used in conjunction with it.
Upvotes: 1
Reputation: 143037
Yes, all javascript functions can be used with jQuery. jQuery is just a plug-in that adds to javascript.
Upvotes: 1
Reputation: 120318
in one word -- absolutely. And I think the only stupid question is the one not asked.
Upvotes: 3