Skip to content

Instantly share code, notes, and snippets.

@axdemelas
Last active June 12, 2016 17:53
Show Gist options
  • Save axdemelas/ffc89270f5273f3bfaea to your computer and use it in GitHub Desktop.
Save axdemelas/ffc89270f5273f3bfaea to your computer and use it in GitHub Desktop.
Example of onstepskip event
var element = document.querySelector('.mdl-stepper');
// Get the MaterialStepper instance of element.
var Stepper = element.MaterialStepper;
// Select any optional step.
var optionalStep = element.querySelector('.mdl-step.mdl-step--optional');
optionalStep.addEventListener('onstepskip', function (event) {
// When the step (this) action button/link with [data-stepper-skip] attribute is clicked
// you can call the skip() method or do anything else.
var skipped = Stepper.skip();
if (!skipped) {
alert('This step cannot be skipped');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment