Unable to use the jquery smartwizard npm package with meteor

53 Views Asked by At

I want to use the smartwizard package in my meteor project. I followed the installation instructions, but I' getting an error.

I installed it with:

npm install smartwizard

added it in the js file:

import "smartwizard/dist/css/smart_wizard_all.css";
import smartWizard from 'smartwizard';

and to initialize it, I've added it into onRendered:

Template.processBar.onRendered(function() {
    $('#smartwizard').smartWizard();
})

But I can't get it work, I just get:

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

JQuery is installed in version 3.7.1. The smartwizard package has version 6.0.6 installed.

What could the problem be and how I can get it to work?

1

There are 1 best solutions below

0
On BEST ANSWER

You need to initialize it. It seems to not have been auto-initialized and I found no documentation of it. I simply checked how the code of the package worked and tried it.

import "smartwizard/dist/css/smart_wizard_all.css";
import smartWizard from 'smartwizard'

// init outside of Templates
smartWizard($)

Template.processBar.onRendered(function() {
    $('#smartwizard').smartWizard();
})