0

I wanted to know how to import jQuery libraries after installing from npm. I did the following, but I encountered the following error.

import countdown from 'jquery.countdown';
$.countdown = countdown;

$("#hours1").countdown("2020/05/01 16:00:00", function (event) {
    $(this).text(event.strftime('%H'));
});

and

import countdown from 'jquery.countdown';
window.$.countdown = countdown;

$("#hours1").countdown("2020/05/01 16:00:00", function (event) {
    $(this).text(event.strftime('%H'));
});

Error:

Uncaught TypeError: $(...).countdown is not a function

2 Answers 2

1

Try to import the scripts from the node_modules folder:

import 'jquery-countdown/dist/jquery.countdown.min.js';
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry, there is no path you mentioned.
1

i believe there is mistake on official NPM page. https://www.npmjs.com/package/jquery-countdown

Try to install by NPM like this:

npm install --save jquery-countdown

and then use

import 'jquery-countdown/dist/jquery.countdown.min';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.