2

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
0

7 Answers 7

3

in one word -- absolutely. And I think the only stupid question is the one not asked.

Sign up to request clarification or add additional context in comments.

Comments

3

jQuery is Javascript, so you may use any type of Javascript logic with jQuery.

Comments

2

can all JS methods be used within jQuery

Yes. jQuery is just a library of JavaScript functions.

Comments

1

Yes, all javascript functions can be used with jQuery. jQuery is just a plug-in that adds to javascript.

Comments

1

Yes since jQuery IS JavaScript any and all JavaScript can be used in conjunction with it.

1 Comment

Many Thanks for all the encouraging replies.
1

Yes. jQuery is a javascript library

Comments

1

can all JS methods be used within jQuery?

Yes. jQuery is a library, not a replacement language.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.