jquery步骤将侦听器添加到“下一步”按钮

jquery步骤将侦听器添加到“下一步”按钮,jquery,jquery-steps,Jquery,Jquery Steps,在jquery步骤中,当用户单击next时,我希望确保所有需要的空格都已填充,否则会弹出警报。 例如,在一个步骤中,有6个复选框,用户需要至少选择一个,如何将事件侦听器添加到下一步按钮?请查看事件部分。有onStepChanging事件 因此,您可以像这样添加事件侦听器: $("#example").steps({ // options // ... onStepChanging: function (event, currentIndex, newIndex) {

在jquery步骤中,当用户单击next时,我希望确保所有需要的空格都已填充,否则会弹出警报。 例如,在一个步骤中,有6个复选框,用户需要至少选择一个,如何将事件侦听器添加到下一步按钮?

请查看事件部分。有
onStepChanging
事件

因此,您可以像这样添加事件侦听器:

$("#example").steps({
    // options
    // ...
    onStepChanging: function (event, currentIndex, newIndex) {
        if (!validate()) {
            // alert and stop when some validation failed
            alert("Error");
            return false;
        } else {
            // proceed
            return true; 
        }
    }
});

请在问题中添加您的代码。太好了!另外:如果只想处理单击下一步按钮的操作,可以在
onStepChanging
函数中选中
If(newIndex>currentIndex){//do something}