Bonjour,
Puisqu’il s’agit d’une matrice (nombres), les valeurs doivent logiquement être numériques.
Par conséquent, le code pour « sélectionné » est : 1.
Sinon, c’est analogue aux autres conditions.
Bien sûr, vous pouvez ajouter une colonne « Autre ».
Matrice(texte)
javascript
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// Identify this question
var thisQuestion = $('#question{QID}');
// Column-specific classes
$('tr.subquestion-list', thisQuestion).each(function(i) {
$('th, td', this).each(function(i) {
$(this).addClass('column-'+i);
});
});
// Insert checkboxes
$('.answer-item.column-1, .answer-item.column-2, .answer-item.column-3, .answer-item.column-4, .answer-item.column-5', thisQuestion).addClass('custom-checkbox-item');
$('.custom-checkbox-item', thisQuestion).each(function(i) {
var thisID = $('input:text:eq(0)', this).attr('id');
$('label', this).before('<input class="" id="'+thisID+'" value="Y" type="checkbox" name="'+thisID.replace(/answer/, '')+'" />');
if($('input:text:eq(0)', this).val() == 'Y') {
$('input:checkbox:eq(0)', this).prop('checked', true);
}
$(this).removeClass('text-item').addClass('checkbox-item');
$('input:text:eq(0)', this).remove();
});
thisQuestion.addClass('custom-array');
});
</script>
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
var thisQuestion = $('#question{QID}');
// Add a question class
thisQuestion.addClass('custom-array');
// Column-specific classes
$('table.subquestion-list tr', thisQuestion).each(function(i) {
$('th, td', this).each(function(i) {
$(this).addClass('column-'+i);
});
});
});
</script>
Code:
<style type="text/css">.custom-array table.subquestion-list col {
width: auto !important;
}
.custom-array table.subquestion-list thead .column-0 { width: 15%; }
.custom-array table.subquestion-list thead .column-1 { width: 10%; }
.custom-array table.subquestion-list thead .column-2 { width: 10%; }
.custom-array table.subquestion-list thead .column-3 { width: 10%; }
.custom-array table.subquestion-list thead .column-4 { width: 10%; }
.custom-array table.subquestion-list thead .column-5 { width: 10%; }
.custom-array table.subquestion-list thead .column-6 { width: 35%; }
.ls-answers tbody .answertext {
text-align: left;
}
</style>
Joffm