NodeJS jQuery ".find" method can't parse the elements contain " "

While i use $(something).find() in NODEJS, it got errors when the content contains   inside. Errors like:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Syntax error, unrecognized expression:  
    at Function.error (/project_path/jquery.min.js:3:15266)
  • It works properly for the contents which NOT includes   inside. Weird!
  • How can i make it work? :(

You cannot directly use Jquery by putting jquery javascript file in your node project and using it in your code. As there is no DOM in node.js (as it is basically server app).

You have to install jquery on server by:

npm install jquery

it installs node-jquery: https://github.com/coolaj86/node-jquery,
with dependencies jsdom: https://github.com/tmpvar/jsdom and htmlparser: https://github.com/tautologistics/node-htmlparser.

Basically these dependencies will create fake DOM for jquery to work with.
Ideally you should not require jquery on server.