I'm working on a side by side table that needs to calculate column totals, row totals, and the percent of the grand total for each row. I've been able to use JavaScript to get column totals, but not the row totals or percentages. What code will work for getting row totals and the percentage of the grand total for each row? I'm completely lost.
I am creating a Side by Side table that needs to have row and column totals. So far, I have been able to use code to create column totals, but I still need help with creating the row totals. Here is the sample JavaScript code I used to create column totals (adopted from another Qualtrics user): Qualtrics.SurveyEngine.addOnReady(function() { var $jq = jQuery.noConflict();// always keep this $jq('.SBS1 input[type="text"]').before('$'); //insert $ sign before boxes $jq('.SBS1 input[type="text"]').after('.00'); //insert .00 after boxes var $sum = 0; // define sum variable $jq('.SBS1 input:last').val($sum); // setting the value of total box $jq('.SBS1 input:last').css('fontWeight','bold') // setting fontface="bold" //color change if($sum>0){ $jq('.SBS1 input:last').css('color','green'); } else{ $jq('.SBS1 input:last').css('color','red'); } // setting the value 0 for all boxes if blank or 0 $jq('.SBS1 input').each(function(){ $jq(this).val(getVal($jq(this).val())); }); $jq('.SBS
I would like to have a visible word counter placed on seven different text entry questions. However, the code I used only works for the first question. Is there code that allows the word counter to work for all questions in a survey? Here is the code I used so far: <span id='wordCountDisplay'>0</span> (to place in the question's HTML) Then put this code in the JavaScript editor Qualtrics.SurveyEngine.addOnReady(function() { var display = $('wordCountDisplay'); var questionID = this.questionId; var textbox =$('QR~' + questionID); var that = this; function countWords(s){ s = s.replace(/\\n/g,' '); // newlines to space s = s.replace(/(^\\s*)|(\\s*$)/gi,''); // remove spaces from start + end s = s.replace(/[ ]{2,}/gi,' '); // 2 or more spaces to 1 if(s == ''){ return 0; }else{ return s.split(' ').length; } } textbox.onkeyup = function(e){ disp
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.