Wikiki / bulma-steps

Bulma's extension to manage steps
MIT License
96 stars 44 forks source link

Trigger "Click" previous button doesn't work #24

Open alvisecastagna1 opened 5 years ago

alvisecastagna1 commented 5 years ago

Hi, I'm trying to trigger the previous button by clicking another element, but nothing happen. Click works (console.log appear) but doesn't go back to previous step.

How can i fix?

Thanks

cawalch commented 5 years ago

You could attach an EventListener to directly call previous_step.

const otherBackBtn = document.getElementById('other-prev-button');
const otherNextBtn = document.getElementById('other-next-button');

const mySteps = new bulmaSteps('#mySteps');

otherBackBtn.addEventListener('click', mySteps.previous_step.bind(mySteps), false);
otherNextBtn.addEventListener('click', mySteps.next_step.bind(mySteps), false);

Example jsfiddle