I am using Qualtrics to create an order form and was able to find a thread on calculations in a text entry matrix table using JS. Is there a way to add a totals line/statement to that or can I add another question and pull the totals from the previous question down to it to create like an “order review”?
Here is the JS that I found that works to calculate price totals.
Paste the following code in the js(OnReady) of the matrix question
jQuery("#"+this.questionId+" td.c5 input[type='text']").attr("readonly",true);
var p=[15,15,15,15,7,7,7,7,20];
jQuery("input[type='text']").each(function()
{
jQuery(this).blur(function()
{
var id = jQuery(this).prop('id');
if(jQuery("[id='"+id+"']").parent().prop('className').split(" ")[0]=="c4")
{
var s=jQuery("[id='"+id+"']").val();
var i=jQuery("[id='"+id+"']").closest(".ChoiceRow").index();
var a=s*p[i] | 0;
jQuery("[id='"+id+"']").closest(".ChoiceRow").find("td.c5 input[type='text']").val(a);
}
});
});