Hi All,
I installed the following jquery and jsdom node modules and trying to load JQuery module for testing purposes.
npm install jquery
npm install jsdom.
After installing these two modules, I have added the following code to load JQuery.
var $ = null;
require("jsdom").env("", function(err, window) {
console.log ('Begin');
if (err) {
console.log ('There was an error');
console.error(err);
return;
}
console.log ('Initializing Jquery');
$ = require("jquery")(window);
});
console.log ('The jquery object is ::' + $);
Output::
When I run the above code, the JQuery object is not initialized. What do I need to do load JQuery module in nodejs?
The jquery object is ::null
I am using the following versions:
"name": "jsdom",
"version": "8.1.0",
"name": "jquery",
"version": "2.2.1",
Thanks,
Sivakumar