JavaScript/jQuery Stepper - Configure a Read-Only Stepper
You can disable all user interaction with Stepper by setting focusStateEnabled to false and assigning the pointer-events: none; CSS style to the component. Define and modify the selectedIndex property to control the Stepper state independently of the component. The code snippet below allows users to change the active step with two Buttons.
index.html
index.js
index.css
- <div id="stepper"></div>
- <div id="buttons">
- <div id="prev"></div><div id="next"></div>
- </div>
- $(() => {
- const stepper = $('#stepper').dxStepper({
- focusStateEnabled: false,
- dataSource,
- }).dxStepper('instance');
- $('#prev').dxButton({
- text: "Previous step",
- onClick: () => {
- const selectedIndex = stepper.option('selectedIndex');
- if (selectedIndex > 0) {
- stepper.option('selectedIndex', selectedIndex - 1);
- }
- }
- });
- $('#next').dxButton({
- text: "Next step",
- onClick: () => {
- const selectedIndex = stepper.option('selectedIndex');
- if (selectedIndex < dataSource.length - 1) {
- stepper.option('selectedIndex', selectedIndex + 1);
- }
- }
- });
- });
- #stepper {
- pointer-events: none;
- }