Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
jQuery with a thin wrapper for Ender.JS, Node.JS, and other npm-based packaging systems
JavaScript
branch: master

This branch is 4 commits ahead, 52 commits behind UncoolAJ86:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
src
test
.gitignore
.npmignore
LICENSE-MIT
README.md
grunt.js
package.json
requirejs-config.json

README.md

node-jQuery

A stupid-simple wrapper over jQuery for Node.JS (server). Currently 1.7.2.

Node.JS

    npm install jQuery

    var $ = require('jQuery');

Examples

    $("<h1>test passes</h1>").appendTo("body");
    console.log($("body").html());

In Node.JS you may also create separate window instances

    var jsdom = require('jsdom').jsdom
      , myWindow = jsdom().createWindow()
      , $ = require('jQuery')
      , jq = require('jQuery').create()
      , jQuery = require('jQuery').create(myWindow)
      ;

    $("<h1>test passes</h1>").appendTo("body");
    console.log($("body").html());

    jq("<h2>other test passes</h2>").appendTo("body");
    console.log(jq("body").html());

    jQuery("<h3>third test passes</h3>").appendTo("body");
    console.log(jQuery("body").html());

Output:

    <h1>test passes</h1>
    <h2>other test passes</h2>
    <h3>third test passes</h3>

JSONP Example

    var $ = require('jQuery');

    $.getJSON('http://twitter.com/status/user_timeline/treason.json?count=10&callback=?',function(data) {
      console.log(data);
    });
Something went wrong with that request. Please try again.