Can I use jQuery with Node.js?

前端 未结 20 2012
清歌不尽
清歌不尽 2020-11-22 05:42

Is it possible to use jQuery selectors/DOM manipulation on the server-side using Node.js?

20条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 06:19

    None of these solutions has helped me in my Electron App.

    My solution (workaround):

    npm install jquery
    

    In your index.js file:

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

    In your .js files write yours jQuery functions in this way:

    jQuery(document).ready(function() {
    

提交回复
热议问题