Follow

Javascript | How to Add jQuery

If you would like to create custom JavaScript functionality using the jQuery library, you will need to add the jQuery library in your job using the following code snippet:


require(['jquery-noconflict'], function($) {
 //Ensure MooTools is where it must be
  Window.implement('$', function(el, nc){
    return document.id(el, nc, this.document);
  });

  var $ = window.jQuery;
  //jQuery goes here
});  

 

If you need to implement the jQuery-UI library, place the following code snippet into the JavaScript portion of your job:


 require({
  paths: {
    "jquery-ui": "https://code.jquery.com/ui/1.11.3/jquery-ui.min"
  },
  map: {
    "*" : { "jquery" : "jquery-noconflict" }
  }
}, [ "jquery-noconflict", "jquery-ui" ], function($) {


  //jQuery goes here
});

 


Was this article helpful?
2 out of 2 found this helpful


Have more questions? Submit a request
Powered by Zendesk