Sum of integer values in a matrix question

Compatibility: IdSurvey 6 IdSurvey 7

The script returns the algebraic sum of integer values (both positives and negatives) in a matrix question, by adding each numerical open-ended answer in a column displaying the result the end of it.

Please Note: the page on which the script is applied, must contain a single matrix question. The script is not compatible with 3D matrixes and simple matrixes with more than one column when filling a CAWI survey from smartphone.

Paste the script in the Client script box. You find it in the gearwheel button of the page containing the matrix. Save.

<script type="text/javascript">
      $(".grid-question-table tbody").append('<tr><td> </td><td><div><input type="text" class="ignoreinput" id="total" readonly="readonly" ></div> </td></tr> ');
      $(".grid-question-wrapper :text, .grid-question-wrapper input[type='number']:not(.ignoreinput)").off("keyup change").on("keyup change", function(){
    $(".grid-question-wrapper :text, .grid-question-wrapper input[type='number']").trigger("keyup");
    function count(){
        var cnt = 0;
        $(".grid-question-wrapper input:not(.ignoreinput)").each(function (){
            var num = parseInt($(this).val());
            if (!isNaN(num)) cnt = cnt + num;
        return cnt;


Leave A Comment?