Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

KTStepper not working in prod mode


We have created a Stepper which works great when built locally, but when building for production and minify are applied it does not work anymore. Pushing "continue" will results in nothing happening. No errors in web console either. Im very confused :D


"use strict";
// Class definition
var OnBoarding = function () {
// Private methods
var initStepper = function (elementId) {
// Stepper lement
var element = document.querySelector("#kt_onboard_stepper");
var options = { startIndex: 1 };

if (element != null) {
// Initialize Stepper
var stepper = new KTStepper(element, options);

// Handle next step
stepper.on("kt.stepper.next", function (stepper) {
stepper.goNext(); // go next step
});
// Handle previous step
stepper.on("kt.stepper.previous", function (stepper) {
stepper.goPrevious(); // go previous step
});
}
}
// Public methods
return {
init: function (elementId) {
initStepper(elementId);
}
}
}();


Also. I have included both Onboarding.init and KTStepper.init in MasterInit.razor.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Hi Remi,

Are you trying to building your application using the "gulp --prod" option? We've looked into this issue and haven't been able to reproduce it on our end.

Also, make sure that you have properly initialized the stepper component. You can refer to the documentation here for guidance:
https://preview.keenthemes.com/html/metronic/docs/general/stepper

If the issue persists, it might be helpful to review your code and configuration to see if there are any discrepancies that might be causing this behavior.

Thanks



Hi Remi,

May I inquire about the method you're using to build and minify your assets? Are you utilizing gulp, webpack, or another build tool for this purpose? This information will help me better understand the context of your issue and provide you with more targeted assistance.



Hello Faizal,
im using Gulp.



I think I got it one step further now.. But im getting
Uncaught TypeError: (new KTStepper(...)).on is not a function


"use strict";

// Class definition
var OnBoarding = function () {
// Private methods
var initStepper = function () {

// Stepper lement
var element = document.querySelector("#kt_onboard_stepper");
var options = { startIndex: 1 };

// Initialize Stepper
var stepper = new KTStepper(element, options);

// Handle next step
stepper.on("kt.stepper.next", function (stepper) {
stepper.goNext(); // go next step
console.log("stepper.next");
});

// Handle previous step
stepper.on("kt.stepper.previous", function (stepper) {
stepper.goPrevious(); // go previous step
console.log("stepper.previous");
});
}
// Public methods
return {
init: function () {

initStepper();
}
}
}();

// On document ready
KTUtil.onDOMContentLoaded(function () {
OnBoarding.init();
});


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(