Skip to content

Instantly share code, notes, and snippets.

@axdemelas
Last active June 12, 2016 17:56
Show Gist options
  • Save axdemelas/14026096cdd8890373e6 to your computer and use it in GitHub Desktop.
Save axdemelas/14026096cdd8890373e6 to your computer and use it in GitHub Desktop.
Example of onstepnext event
var stepperElement = document.querySelector('.mdl-stepper');
// Get the MaterialStepper instance of element.
var Stepper = stepperElement.MaterialStepper;
// Select any step.
var step = element.querySelector('.mdl-step');
step.addEventListener('onstepnext', function (event) {
// When the step (this) action button/link with [data-stepper-next] attribute is clicked
// you can do some condition to advances and error or do anything else.
if (true) {
// Your conditionally stepper advances.
Stepper.next();
} else {
myStepper.error('Alert message here');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment