Last active
June 12, 2016 17:56
-
-
Save axdemelas/14026096cdd8890373e6 to your computer and use it in GitHub Desktop.
Example of onstepnext event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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