- Posts: 11
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Ihre Bewertung lautet: <b><span id="starvalue"> </span></b> <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= 'mangelhaft'; break; case '2': insertedText= 'ausreichend'; break; case '3': insertedText= 'befriedigend'; break; case '4': insertedText= 'gut'; break; case '5': insertedText= 'sehr gut'; break; } // Pipe the text to the div $('#starvalue').text(insertedText); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var q1ID = {QID}; var thisQuestion = $('#question'+q1ID); var insertedTexts = { '1': 'mangelhaft', '2': 'ausreichend', '3': 'befriedigend', '4': 'gut', '5': 'sehr gut' }; $('#starvalue').attr('data-text', ''); // Listener on the radio inputs $('input.radio', thisQuestion).on('click', function(e) { // The clicked value var value = $(this).val(); // Pipe the text to the div $('#starvalue').text(insertedTexts[value]).attr('data-text', insertedTexts[value]); }); // Hover events on the stars $('.star-rating', thisQuestion).hover( function() { // The value var value = $(this).attr('data-star'); // Pipe the dynamic text to the div $('#starvalue').text(insertedTexts[value]); }, function() { $('#starvalue').text($('#starvalue').attr('data-text')); } ); }); </script>