- Posts: 11
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); var lastInput = $('input:text:last', thisQuestion); var lastItem = $(lastInput).closest('div'); // Insert the check-box $(lastItem).addClass('checkbox-item with-inserted-checkbox').append('<input type="checkbox" name="insertedInput" id="insertedInput" value=""><label for="insertedInput" class="checkbox-label control-label"></label>'); // Listener on the checkbox $(':checkbox', lastItem).on('change', function(e) { if($(this).is(':checked')) { $('input:text', thisQuestion).not(lastInput).val('').trigger('keyup'); $(lastInput).val(100).trigger('keyup'); $('li.ls-group-dynamic', thisQuestion).hide(); } else { $('li.ls-group-dynamic', thisQuestion).show(); $(lastInput).val('').trigger('keyup'); } }); }); </script>
<style type="text/css"> .numeric-multi .with-inserted-checkbox input.form-control { position: absolute; left: -9999em; } .numeric-multi .with-inserted-checkbox label::before, .numeric-multi .with-inserted-checkbox label::after { margin: -7px 0 0 0; } </style>