Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Disable specific boxes (=answer options) in a array question (numbers)

More
2 years 11 months ago #214255 by batpurev
hi all,

Does anyone know how to disable an Array element and show some Sum of other elements of the same array? (Question type: Array (Texts) 

thanks in advance.
Attachments:
The topic has been locked.
More
2 years 11 months ago #214256 by batpurev
Based on posts on this thread I tried followings but none seems to work.

<script type="text/javascript" charset="utf-8">
   $(document).ready(function() {
        $('array-multi-flexi[id="q1_x1_y1"]').attr('disabled', 'disabled');
        $('array[id="q1_x1_y1"]').attr('disabled', 'disabled');
        $('input[name="q1_x1_y1"]').hide();
       $('array-multi-flexi[name="q1_x1_y1"]').hide();
       $('input[name="#answertextq1_x1_y1"]').attr('disabled', 'disabled');
   });
 </script>

The topic has been locked.
More
2 years 11 months ago #214259 by batpurev
Found solution to my question below is my code if anyone faces similar issue.

<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        $('input[id="answer752589X30X2319x1_y1"]').attr('disabled', 'disabled');});
    
    $("#limesurvey").on("change", function(event) { 
         var k = parseFloat($('input[id="answer752589X30X2319x2_y1"]').val());
         var l = parseFloat($('input[id="answer752589X30X2319x3_y1"]').val());
         var m = k+l;
         $('input[id="answer752589X30X2319x1_y1"]').val(m);
});
</script>

The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose