?
Solved

Using jquery UI with npm

Posted on 2016-07-30
3
Medium Priority
?
2,270 Views
Last Modified: 2016-08-11
HI,
I installed jquery-ui using the command
npm install jquery-ui --save
And included it into my javascript file like :
var $ = require("jquery"), require("jquery-ui");
But on calling $("#dialog").dialog({ autoOpen: false });
I am getting the following error on console :
TypeError: $(...).dialog is not a function
$("#dialog").dialog({ autoOpen: false });
new.js (line 56, col 6)

what could be the reason for this ?
How to use jquery-ui ?
I am using webpack in my application to bundle modules.

Thanks
0
Comment
Question by:Rohit Bajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 41736428
Shouldn't be this way?
var $ = require("./jquery"), require("./jquery-ui");

Open in new window

0
 

Author Comment

by:Rohit Bajaj
ID: 41736665
Hi,
./jquery will look for jquery file in current directory whereas i am using it through npm.
require(jquery) works fine... only problem when is when i include jquery-ui which ideally should have dialog function things dont work somehow..
0
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 2000 total points
ID: 41736716
Mybe you have to edit your webpack.config.js? I found that you have to add this:
resolve : {
    alias: {
      // bind version of jquery-ui
      "jquery-ui": "jquery-ui/jquery-ui.js",      
      // bind to modules;
      modules: path.join(__dirname, "node_modules"),
    }
}

Open in new window

Full answer here: http://stackoverflow.com/questions/33998262/jquery-ui-and-webpack-how-to-manage-it-into-module
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question