Sorry for the late reply. Thanks! This works.
Nvm. I think I figured it out. There was a problem in the compute_total function that was preventing it from working properly until a radio button was clicked. Also, the following two queries worked for me: jQuery("document").ready(compute_total); jQuery("document").ready(drawChart);
This works! Can't thank you enough Tom 😀 Is there any reason why the document.getElementById methods don't work? Since last week when I first posted, I have done a bit of research wrt Javascript and jQuery through w3schools. But the base commands don't seem to work the same in the Qualtrics engine. Would there be any resource on the Qualtrics API or jQuery methods that I could look into?
Hey Thanks! I did a little variation on this, and it worked! The coding I've done right now doesn't look pretty, but doesn't take too much time to run, and I can work on improving it later on. Sorry for the long time to replies. This has been really helpful. As for the solution, the thing that seemed to work best for me was to have a look at ALL question responses every time an option was changed (so that as I change responses, the score doesn't keep on getting incremented indefinitely), and update totalscore accordingly. Instead of adding JS to each question, I added one long code to the first question: `Qualtrics.SurveyEngine.addOnload(function() { /*Place your JavaScript here to run when the page loads*/ //$$('.question').forEach(ele=>ele.addClassName('fixed')); /*Implements scoring on clicking of any of the radio buttons*/ jQuery("input[type=radio]").change(function() { if(jQuery("#QID10 input.radio").is(":checked")){ var choiceNum1 = jQuery("#QID10 input.radio:che
@TomG Would there not be any way of having multiple questions on the same page? The final questionnaire might be much longer (~50 questions) and the respondent would often have the need to revisit some previous response. In such a situation, I could see that to see the score the respondent would have to scroll to the very top, which would also be inconvenient. But possibly the inconvenience caused due to difficulty in accessing a particular question might be greater. EDIT: I figured out how to keep the score fixed at the top (even if right now it looks a little ugly). In the first question, I added the following HTML <div class = "question"> Total Score is: <span id="tScore">${gr://SC_0AllARgoJfrJDr7/Score}</span> </div> <div class = "question_spacer"> This is a spacer element </div> <style> .question{ background: white; width:100%; z-index: 1000;
Hey @TomG! Sorry for the late response back, but at the time of asking the question I had little to no knowledge of HTML and Javascript, so spent some time understanding things on w3schools. I tried to implement the solution you suggested but am still confused on certain aspects of point 2. To be entirely clear, I’ll use an example below to convey my problem. ! Suppose I have a survey with 7 questions (q1, q2, q3...) with a different number of options in each question (the options can be labelled as q1: {a11, a12, a13}, q2: {a21, a22, a23, a24, a25}, q3: {a31, a32, a33, a34} and so on. All questions are multiple-choice, single-answer. The score for the options can be x11, x12, x13, x21, x22… etc. (the numbers are all decimals): when I select a11, the score displayed on the page should be = x12. If after that, I select a22, the score should be = x11 + x22. If I deselect option 11, the score should automatically update to x22, without me needing to change the page. I may need to do mo
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.