Using JS Methods in jQuery
In the following code snippet, the String.fromCharCode is used, can all JS methods be used withi开发者_开发百科n 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
in one word -- absolutely. And I think the only stupid question is the one not asked.
jQuery is Javascript, so you may use any type of Javascript logic with jQuery.
can all JS methods be used within jQuery
Yes. jQuery is just a library of JavaScript functions.
Yes, all javascript functions can be used with jQuery. jQuery is just a plug-in that adds to javascript.
Yes since jQuery IS JavaScript any and all JavaScript can be used in conjunction with it.
Yes. jQuery is a javascript library
can all JS methods be used within jQuery?
Yes. jQuery is a library, not a replacement language.
精彩评论