Solved

Using jquery UI with npm

Posted on 2016-07-30
3
283 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
  • 2
3 Comments
 
LVL 30

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 30

Accepted Solution

by:
Marco Gasi earned 500 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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:
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now