'Using jquery-ui with webpack. Problem with importing
I'm using Jquery and Jquery-ui for creating a datepicker. As module bundler I'm using webpack. And when I'm trying run my project i get this error:
Uncaught TypeError: jquery__WEBPACK_IMPORTED_MODULE_0___default(...)(...).datepicker is not a function
Here's my code:
import $ from "jquery";
import { datepicker } from "jquery-ui";
const currentTime = new Date()
const maxDate = new Date(currentTime.getFullYear(), currentTime.getMonth());
$(function () {
$(".datepicker").datepicker({
dateFormat: 'yy-mm-dd',
defaultDate: 1,
showOtherMonths: true,
selectOtherMonths: true,
maxDate: new Date()
}).datepicker('setDate', new Date());
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
