Consider following code snippet:

  var jQ = jQuery.YYY();

  jQ( function() {
      jQ("a").click(function() {
         // some code
      });   
  });
You need to use new alias for jQuery with name jQ. What should you insert into code instead of YYY?
Explanation
Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery's case, $ is just an alias for jQuery, so all functionality is available without using $. If you need to use another JavaScript library alongside jQuery, you can return control of $ back to the other library with a call to $.noConflict(). Old references of $ saved during jQuery initialization; noConflict() simply restores them.

Done, @docahrens! :)

2016 Jun 20, 6:17:58 PM

You seem to misunderstand noConflict() or your question is poorly worded. var jQ = jQuery; works without the .noConflict(); Your question should read: 'You needto to use another alias for jQuery other than $ because another library is using '$'. You want your new alias to be 'jQ'. What method should you insert into code instead of YYY to remove jQuery's '$' alias before using jQ in the remaining code?

2016 Jun 18, 12:04:50 AM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
JavaScript quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes