- Posts: 83
- Thank you received: 3
Ask the community, share ideas, and connect with other LimeSurvey users!
Other: {Q1_other}
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify this question var thisQuestion = $('#question{QID}'); var thisOther = $('input.checkbox[id$="othercbox"]', thisQuestion); var thisOtherText = $('input.text[id$="other"]', thisQuestion); var otherToggle = $('input.checkbox[id$="myOther"]', thisQuestion); // Hide the "toggle" option $(otherToggle).closest('li.question-item ').hide(); // Listeners on the inputs $(thisOther).change(function(e) { handleOther(); }); $(thisOtherText).on('change keyup', function(e) { handleOther(); }); // A function to check the "toggle" option depending on the state od "Other" function handleOther() { $(otherToggle).prop('checked', $(thisOther).prop('checked')); checkconditions($(otherToggle).attr('value'), $(otherToggle).attr('name'), $(otherToggle).attr('type')) } }); </script>