1282');
$('head').append('');
$.getScript(rootPath+'assets/packages/bootstrap/plugins/datetimepicker/build/js/bootstrap-datetimepicker.min.js')
.done(function(script, textStatus) {
// Insert the date-time-pickers
$('.answer-item.answer_cell_SQ003 input:text', thisQuestion).each(function(i) {
var thisID = $(this).attr('id');
$(this).addClass('date-control date datetimepicker')
.wrap('
')
.after('
\
\
');
$('#datetimepicker_'+thisID+'').datetimepicker({
useCurrent:false,
allowInputToggle: true,
format: 'DD.MM.YYYY'
});
});
})
.fail(function( jqxhr, settings, exception ) {
console.log(exception);
});
});
$(document).on('ready pjax:scriptcomplete',function(){
var thisQuestion = $('#question1282');
// Insert selects
$('.answer-item.answer_cell_SQ004', thisQuestion).addClass('with-select').append('\
Choisir une réponse...\
Lycée Général\
Lycée Technologique\
Section Professionelle\
BTS\
Autre Formation\
');
// Listeners
$('.inserted-select', thisQuestion).on('change', function(i) {
if($(this).val() != '') {
$(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).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());
var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
$('select.inserted-select', thisCell).val(selectval);
});
// Clean-up styles
$('select.inserted-select', thisQuestion).css({
'max-width': '100%'
});
$('.with-select input:text', thisQuestion).css({
'position': 'absolute',
'left': '-9999em'
});
});
De l'élève