Just to clarify why this is happening - in the render
function (line 892), the content of the wizard is removed using .empty()
and thus any listeners bound to elements inside it are lost.
wizard.attr("role", "application").empty().append(stepsWrapper).append(contentWrapper)
.addClass(options.cssClass + " " + options.clearFixCssClass + verticalCssClass);
So there are three options to solve this, the first is to do as Trevor said and bind your listeners to either the wizard element or some element above it in the DOM.
The second is to add a callback for when the plugin has finished loading and initialise your listeners as normal at that point.
The third is to change the render
function to use the original html (and therefore the original listeners), like so:
function render(wizard, options, state) {
// Create a content wrapper and copy HTML from the intial wizard structure
var contentWrapperTemplate = "<{0} class=\"{1}\"></{0}>",
stepsWrapperTemplate = "<{0} class=\"{1}\">{2}</{0}>",
orientation = getValidEnumValue(stepsOrientation, options.stepsOrientation),
verticalCssClass = (orientation === stepsOrientation.vertical) ? " vertical" : "",
contentWrapper = $(contentWrapperTemplate.format(options.contentContainerTag, "content " + options.clearFixCssClass)),
stepsWrapper = $(stepsWrapperTemplate.format(options.stepsContainerTag, "steps " + options.clearFixCssClass, "<ul role=\"tablist\"></ul>"));
// Transform the wizard wrapper by wrapping the innerHTML in the content wrapper, then prepending the stepsWrapper
wizard.attr("role", "application").wrapInner(contentWrapper).prepend(stepsWrapper)
.addClass(options.cssClass + " " + options.clearFixCssClass + verticalCssClass);
//Now that wizard is tansformed, select the the title and contents elements
var populatedContent = wizard.find('.content'),
stepTitles = populatedContent.children(options.headerTag),
stepContents = populatedContent.children(options.bodyTag);
// Add WIA-ARIA support
stepContents.each(function (index) {
renderBody(wizard, state, $(this), index);
});
stepTitles.each(function (index) {
renderTitle(wizard, options, state, $(this), index);
});
refreshStepNavigation(wizard, options, state);
renderPagination(wizard, options, state);
}