我在 jQuery UI Accordion 中有一个表单。
使用此代码,访问者必须验证第一个面板,然后才能打开下一个手风琴面板。但是,如果访问者想要返回第一个面板,它不会放手。
$(document).ready(function () {
$("#accordion").accordion({ event: false });
$('#openfirst').click(function () {
if (varification is okay then) {
$("#accordion").accordion({ active: 1 });
// cancel submit
return false;
} else {
alert('Please acknowledge the following before proceeding.');
}
});
$('#opensecond').click(function () {
if (varification is okay then) {
$("#accordion").accordion({ active: 2 });
} else {
alert('Please acknowledge the following before proceeding.');
}
});
$('#openthird').click(function () {
if (varification is okay then) {
$("#accordion").accordion({ active: 3 });
// cancel submit
return false;
} else {
alert('Please acknowledge the following before proceeding.');
}
});
});
</script>