Group
638
af
am
ar
az
bg
bn
ca
cs
da
de
el
en
es
et
fi
fr
gu
hat
he
hi
hr
hu
id
it
ja
ko
lt
lv
ms
mya
nl
pa
pl
pt
pt-BR
ro
ru
si
sk
sl
sq
sr
sr-Latn
sv
ta
th
tl
tr
uk
ur
uz
vi
zh-Hans
zh-Hant-TW
gid
sid
group_order
randomization_group
grelevance
id
gid
group_name
description
language
sid
group_order
randomization_group
grelevance
qid
parent_qid
sid
gid
type
title
preg
other
mandatory
question_order
scale_id
same_default
relevance
modulename
encrypted
question_theme_name
same_script
qid
parent_qid
sid
gid
type
title
preg
other
mandatory
question_order
scale_id
same_default
relevance
modulename
encrypted
question_theme_name
same_script
id
qid
question
help
language
script
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
I believe that all members of the top leadership team are visibly and systematically committed to achieving gender equality in this organization.
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
// A function to handle "child" checkboxes
function dependantCheckboxes(qID, primaryCodes, secondaryCodes, tertiaryCodes) {
// Identify the elements annd assign classes/attributes
var thisQuestion = $('#question'+qID);
thisQuestion.addClass('with-dependants');
$.each(primaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
$(thisItem).addClass('level-1 parent-item').attr('data-code', val).attr('data-level', '1');
});
$.each(secondaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
$(thisItem).addClass('level-2 parent-item child-item').attr('data-code', val).attr('data-level', '2').attr('data-parent-1', $(thisParent1).attr('data-code'));
});
$.each(tertiaryCodes, function(i, val) {
var thisItem = $('li[id$="X'+qID+val+'"]');
var thisParent1 = $(thisItem).prevAll('li[data-level="1"]:eq(0)');
var thisParent2 = $(thisItem).prevAll('li[data-level="2"]:eq(0)');
$(thisItem).addClass('level-3 child-item').attr('data-code', val).attr('data-level', '3').attr('data-parent-1', $(thisParent1).attr('data-code')).attr('data-parent-2', $(thisParent2).attr('data-code'));
});
// A function to handle the states of child items
function handleChildren(el) {
var thisitem = $(el).closest('li');
var thisCode = $(thisitem).attr('data-code');
var thisLevel = $(thisitem).attr('data-level');
var thisChildren = $('li[data-level="'+(Number(thisLevel)+1)+'"][data-parent-'+thisLevel+'="'+thisCode+'"]', thisQuestion);
// Hide/show the secondary answers accordingly
if (!$(el).is(':checked')) {
$(thisChildren).fadeOut(300, function(e) {
$('input:checkbox', thisChildren).prop('checked', false).trigger('change');
});
}
else {
$(thisChildren).fadeIn(300);
}
}
// Initial states of the secondary answers
$('.parent-item input:checkbox', thisQuestion).each(function(i) {
handleChildren($(this));
});
// A listener on the primary answer to show or hide secondary answers
$('.parent-item input:checkbox', thisQuestion).on('change', function(e) {
handleChildren($(this));
});
}
$(document).on('ready pjax:scriptcomplete',function(){
dependantCheckboxes(
{QID},
['SQ1', 'SQ2', 'SQ3', 'SQ4', 'SQ5', 'SQ6',], // First-level sub-question codes
['SQ21', 'SQ22', 'SQ23', 'SQ31', 'SQ32', 'SQ33', 'SQ41', 'SQ42', 'SQ43', 'SQ51', 'SQ52', 'SQ53', 'SQ61', 'SQ62', 'SQ63'], // Second-level sub-question codes
[] // Third-level sub-question codes
);
});
]]>
aid
qid
code
sortorder
assessment_value
scale_id
id
aid
answer
language
qid
attribute
value
language