daemonhanky
Forum Replies Created
-
Exactly what I needed.
Thank you so much!
I’ve come up with an interim solution if anyone is interested.
The loading animation starts when the quiz is busy processing results, so I am checking for if that exists when submit is clicked, then after a time I do what I want
(in this case creating a cookie with the score).jQuery code is below:
//store score after the user submits $('.quiz').on('click', '.qsm-submit-btn', function(){ quizID = $(this).parents('.quiz').attr('id').toString(); if($('.qsm_quiz_processing_box').length > -1){ setTimeout(function(){ moduleName = quizID; score = $('.score').text().toString(); if(localStorage.getItem(moduleName) === null){ localStorage.setItem(moduleName, score); } },3000); } });Thanks.
- This reply was modified 4 years, 1 month ago by daemonhanky. Reason: fixed typo
I appreciate the help.
Thanks Sumit.
Here is the code I’ve attempted to use.
//store score after the user submits
$quizID = ”;
$(‘.quiz’).on(‘click’, ‘.qsm-submit-btn’, function(){
$quizID = $(this).parents(‘form’).attr(‘id’);
console.log($quizID);
});
document.addEventListener( ‘qmnFormSubmit’, $(‘#’+$quizID), function( event ) {
console.log(‘hello2’);
moduleName = $(this).parents(‘.quiz’).attr(‘id’).toString();
score = $(‘.score’).text().toString();
}, false);