Search code examples
javascriptjqueryjquery-steps

select2 with wizard step by step


Can someone help me with this step by step, I can not use select2 within the step by step wizard, someone knows where to insert the select2 code.

$(".select2wizard").select2();

I have not found anything in github, it is a wizard with validation, but it does not even recognize select2

I tried to start select2 out and it does not work, but from what I understand I need to do it in here, I just do not know where.

var form = $(".validation-wizard").show();

$(".validation-wizard").steps({ 
    headerTag: "h6"
    , bodyTag: "section"
    , transitionEffect: "fade"
    , titleTemplate: '<span class="step">#index#</span> #title#'
    , labels: {
        finish: "Submit"
    }
    , onStepChanging: function (event, currentIndex, newIndex) {
        ////
    }
    , onFinishing: function (event, currentIndex) {
        ///
    }
    , onFinished: function (event, currentIndex) {
         swal("Form Submitted!", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lorem erat eleifend ex semper, lobortis purus sed.");
    }

}), $(".validation-wizard").validate({
    ignore: "input[type=hidden]"
    , errorClass: "text-danger"
    , successClass: "text-success"
    , highlight: function (element, errorClass) {
        $(element).removeClass(errorClass)
    }
    , unhighlight: function (element, errorClass) {
        $(element).removeClass(errorClass)
    }
    , errorPlacement: function (error, element) {
        error.insertAfter(element)
    }
    , rules: {
        email: {
            email: !0
        }
    }
})

Solution

  • I think you have to change in below section of your Source Code:

    onStepChanging: function (event, currentIndex, newIndex) {

    $(".select2wizard").select2();
    }