Hi,
I was wondering if it's possible to change the following script to create the same type of question we were talking above but with one difference: the last one column should be a checkbox instead of a menu dropdown (obviously we should have just one option with the checkbox instead of three like in the menu dropdown).
There is the script I'm using now:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
var thisQuestion = $('#question{QID}');
// Insert selects
$('.answer-item.answer_cell_X005', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">...</option>\
<option value="1">increase</option>\
<option value="2">stay the same</option>\
<option value="3">decrease</option>\
</select>');
// Listeners
$('.inserted-select', thisQuestion).on('change', function(i) {
if($(this).val() != '') {
$(this).closest('.answer-item').find('input:text').val($('option:selected', this).val()).trigger('change');
}
else {
$(this).closest('.answer-item').find('input:text').val('').trigger('change');
}
});
// Returning to page
$('.with-select input:text', thisQuestion).each(function(i) {
var thisCell = $(this).closest('.answer-item');
var inputText = $.trim($(this).val());
$('select.inserted-select', thisCell).val(inputText);
});
// Clean-up styles
$('select.inserted-select', thisQuestion).css({
'max-width': '100%'
});
$('.with-select input:text', thisQuestion).css({
'position': 'absolute',
'left': '-9999em'
});
// Set the first two columns to readonly
$('.answer-item:nth-child(2) input:text', thisQuestion).prop('readonly', true);
$('.answer-item:nth-child(3) input:text', thisQuestion).prop('readonly', true);
});
</script>
Thanks in advance
Carlotta