diff --git a/examples/index.html b/examples/index.html index 0ddbfdd..068d7e1 100755 --- a/examples/index.html +++ b/examples/index.html @@ -95,6 +95,27 @@ return $( this ).wizard( "form" ).valid(); } }).wizard( "form" ).validate( validate ); + + // Example 6: Dynamically add steps to the wizard + var $example6 = $( "#example-6" ).wizard(); + + $example6.find( "[name=e6-howMany]" ).on( "change", function() { + var $this = $( this ); + var howMany = $this.val(); + + // Remove previously added dynamic steps + $example6.find( ".step.dynamic" ).remove(); + + // Add in selected number of steps + for (var i = 0, l = howMany; i < howMany; i++) { + $example6.find( ".steps" ).append( + $( "
" ).addClass( "dynamic step" ).text( "Dynamically created step #" + (i + 1) ) + ); + } + + // Destroy and re-create the wizard + $example6.wizard( "destroy" ).wizard(); + }); }); @@ -252,6 +273,31 @@

Clearing Input Values Before Navigating

+ +
+

Create Steps Dynamically

+ +
+
+
+

How many steps would you like to create?

+ +
+
+ + +
+