Hi
I have a quiz that uses javascript to calculate the scores over 10 pages of a template which uses jquery. I’m having trouble disabling the navigation buttons so that the user cannot move on until they submit the question.
The code is in Jquery and Javascript and i’m still learning.
I tried this which worked as it stopped them from navigating away from the page but it stopped my quiz from calculating the score too….
[CODE] //Next Page Function
$(‘.next’).click(function() {
if (current_page == no_pages){
//do nothing
}
else{
if (flag==false)
{
try {
checkAnswer(document.getElementById(‘quizForm’))
flag=true;
return false;
}
catch(err)
{
if (err.number !=-2146823281)
{
alert(err.description);
}
}
}
next_page = (current_page + 1);
$(“#content”).fadeOut(“slow”,function(){
$(“#content”).load(“pages/page_” + next_page + “.html”).fadeIn(‘slow’)}
);
current_page ++;
$(“#current_page”).html(current_page);
progress_bar();
}
});
This is what the code looks like now without the changes….
[CODE]//Next Page Function
$(‘.next’).click(function() {
if (current_page == no_pages){
//do nothing
}
else{
next_page = (parseInt (current_page) + 1);
$(“#content”).fadeOut(“slow”,function(){
$(“#content”).load(“pages/page_” + next_page + “.html”).fadeIn(‘slow’)}
);
current_page ++;
$(“#current_page”).html(current_page);
progress_bar();
}
});
I was also told to try and disable and then enable the button but i’m not really sure what i’m doing.
I put this bit together but it doesn’t do anything….
[CODE]else{
if (document.getElementById(‘quizForm’)){
if (document.quizForm.cc.disabled==true)
document.quizForm.cc.disabled=false
else
{return true;}
Any advice would be appreciated.
Thanks