Topic: Stepper prevent default
alex_wearelanded priority asked 10 months ago
document.querySelector('.stepper').addEventListener('stepChange.mdb.stepper', (e) => {
console.log(e);
if(e.nextStep == 3){
if(!array['stages']){
e.preventDefault();
}
}
});
This works currently when i click from stepper 0 to 3, but if i click from stepper 4 to 3, it runs this code hits the preventdefault but still opens the stepper? why is this, ideally it shouldnt, strange works correctly as i say clicking into 3 from 0 but not 4 to 3
Grzegorz Bujański staff answered 10 months ago
Can you prepare a snippet in which I can reproduce this issue? I created a snippet that will do e.preventDefault
for a step with index 3
and it works fine for me: https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/5967302#js-tab-view
alex_wearelanded priority commented 10 months ago
Hello Grzeogorz,
i have seen your snippet, however the condition you have do not match my descriptions, can you try changing your step in ur js to 2 then click from step 3 to 2 in that order and see if it works,
Grzegorz Bujański staff commented 10 months ago
Everything seems to be working. Maybe I don't understand the problem exactly or I created the snippet incorrectly. Please create your own snippet and describe step by step what I should do to reproduce the issue.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 7.1.0
- Device: mac
- Browser: chrome
- OS: big sur
- Provided sample code: No
- Provided link: No