- Posts: 98
- Thank you received: 7
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Find the checked option for question code G2Q1N var qc = '{G2Q1N}'; if(qc == "1"){ document.getElementById('answer{SID}X{GID}X{QID}SQ001-A1').checked = true; }else if(qc == "2"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A2").checked = true; } else if(qc == "3"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A3").checked = true; } else if(qc == "4"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A4").checked = true; } else if(qc == "5"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A5").checked = true; } }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ if($('#question{QID}').hasClass('my-class') { // Find the checked option for question code G2Q1N var qc = '{G2Q1N}'; if(qc == "1"){ document.getElementById('answer{SID}X{GID}X{QID}SQ001-A1').checked = true; }else if(qc == "2"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A2").checked = true; } else if(qc == "3"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A3").checked = true; } else if(qc == "4"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A4").checked = true; } else if(qc == "5"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A5").checked = true; } } }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ if($('#question{QID}').hasClass('my-class') { // Find the checked option for question code G2Q1N var qc = '{G2Q1N}'; // Check the corresponding option here $('#answer{SID}X{GID}X{QID}SQ001-A'+qc).prop('checked', true); } }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ if($('#question{QID}').hasClass('.array-5-pt') { // Find the checked option for question code Q1 var qc = '{Q1}'; // Check the corresponding option here $('#answer{SID}X{GID}X{QID}SQ001-A'+qc).prop('checked', true); } }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Find the checked option for question code G2Q1N var qc = '{G2Q1N}'; if(qc == "1"){ document.getElementById('answer{SID}X{GID}X{QID}SQ001-A1').checked = true; }else if(qc == "2"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A2").checked = true; } else if(qc == "3"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A3").checked = true; } else if(qc == "4"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A4").checked = true; } else if(qc == "5"){ document.getElementById("answer{SID}X{GID}X{QID}SQ001-A5").checked = true; } }); </script>