Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JayceLin/node-jquery

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

143 Commits
143 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to use jQuery in Node.js

How to use jQuery >= 2.x in Node.js >= 0.10

npm install -S 'jquery@>=2.1'
npm install -S 'jsdom@latest'

testjq.js:

(function () {
  'use strict';

  var env = require('jsdom').env
    , html = '<html><body><h1>Hello World!</h1><p class="hello">Heya Big World!</body></html>'
    ;

  // first argument can be html string, filename, or url
  env(html, function (errors, window) {
    console.log(errors);

    var $ = require('jquery')(window)
      ;

    console.log($('.hello').text());
  });
}());

The instructions above are for the new official jquery which, for some reason, doesn't have instructions for node in their README.

Don't use the actual code in this repo. It's obsolete and only kept around for legacy apps.

About

jQuery with a thin wrapper for Ender.JS, Node.JS, and other npm-based packaging systems

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.