I am having a problem with a multi-page form submission. The problem is that the page is refreshing when I press the next page button. I believe it is a return true/false problem, but I don’t know where the issue is. Here is the code:
$(document).ready(function () {
var info = [];
function showinfo() {
for (i=0; i<info.length; i++) {
$('#step3 ul').append(
$('<li>' + info[i] + '</li>')
);
};
};
$('#step1_btn').click(function() {
$("input").each(function() {
if (input.type != radio) {
info.push(this.name+':'+this.value);
} else if ($('.radio').is(':checked')) {
info.push(this.name+':'+this.value);
}
});
$('#step1').css('display','none');
$('#step2').css('display','inherit');
$('#progbar').attr('value',33);
return false;
});
$('#step2_btn').click(function() {
$("input").each(function() {
if (input.type != radio) {
info.push(this.name+':'+this.value);
} else if ($('.radio').is(':checked')) {
info.push(this.name+':'+this.value);
}
});
$('#step2').css('display','none');
$('#step3').css('display','inherit');
$('#progbar').attr('value',66);
showinfo();
return false;
});
});
Not sure if that is all you need to see. If you need to see the html as well, I can provide that. Thanks in advance for any help you all can give. I can read javascript fairly well when someone else writes it, but for some reason writing it myself ends up in catastrophe every time.
try event.preventDefault():