- Posts: 350
- Thank you received: 41
Ask the community, share ideas, and connect with other LimeSurvey users!
// Insert the radios $(this).parent().addClass('radio').append('<span class="inserted-radio-wrapper">\ <input id="'+thisID+'-Y" class="radio" value="Y" name="'+thisID.replace(/answer/, '')+'_radio" type="radio">\ <label class="control-label radio-label" for="'+thisID+'-Y">Yes</label>\ </span>\ <span class="inserted-radio-wrapper">\ <input id="'+thisID+'-N" class="radio" value="N" name="'+thisID.replace(/answer/, '')+'_radio" type="radio">\ <label class="control-label radio-label" for="'+thisID+'-N">No</label>\ </span>'); // Initial radio states $(this).closest('td').find('input[type="radio"][value="'+thisValue+'"]').prop('checked', true); }); // Listener on the radios $('.answer-item.column-2 input[type="radio"]', thisQuestion).on('click', function() { var thisInput = $(this).closest('td').find('input[type="text"]'); $(this).closest('td').find('input[type="text"]').val($(this).val()); checkconditions($(thisInput).val(), $(thisInput).attr('name'), 'text'); });
// Insert the checkboxes $(this).parent().addClass('checkbox').append('<span class="inserted-checkbox-wrapper">\ <input id="'+thisID+'-Y" class="checkbox" value="Y" name="'+thisID.replace(/answer/, '')+'_checkbox" type="checkbox">\ <label class="control-label checkbox-label" for="'+thisID+'-Y">En vastaa tähän</label>\ </span>\ '); // Initial checkbox states $(this).closest('td').find('input[type="checkbox"][value="'+thisValue+'"]').prop('checked', false); }); // Listener on the checkboxes $('.answer-item.column-2 input[type="checkbox"]', thisQuestion).on('click', function() { var thisInput = $(this).closest('td').find('input[type="text"]'); $(this).closest('td').find('input[type="text"]').val($(this).val()); checkconditions($(thisInput).val(), $(thisInput).attr('name'), 'text'); });