- Posts: 11
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Q1... <div id="starvalue"></div> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var q1ID = {QID}; var thisQuestion = $('#question'+q1ID); // Listener on the inputs $('input.radio', thisQuestion).on('click', function(e) { // The clicked value var value = $(this).val(); // Define the text var insertedText= ''; switch(value) { case '1': insertedText= 'One'; break; case '2': insertedText= 'Two'; break; case '3': insertedText= 'Three'; break; case '4': insertedText= 'Four'; break; case '5': insertedText= 'Five'; break; } // Pipe the text to the div $('#starvalue').text(insertedText); }); }); </script>
Q1... <div id="starvalue"></div> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var q1ID = {QID}; var thisQuestion = $('#question'+q1ID); // Define the text var insertedText = { 1: 'Text for one star', 2: 'Text for two stars', 3: 'Text for three stars', 4: 'Text for four stars', 5: 'Text for five stars' } // Listener on the inputs $('input.radio', thisQuestion).on('click', function(e) { // Pipe the text to the div $('#starvalue').text(insertedText[$(this).val()]); }); }); </script>