We are trying to create a question like the attached picture.
I can get the dual scales, but is there a way to put the actual question in the "middle"?
I successfully have used this workaround in a survey. In another survey I'd now like to use the expression manager for conditional wording in the answers. This works fine with the normal array dual scale. But when using the tpartner's code, the expression inside the {} is no longer recongized. Is there a solution for that? LS version is 2.73.
It seems to be a bug in Expression Manager. The perfectly valid JavaScript syntax for the styles is preventing EM from parsing the values in the curly braces.
Try this:
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Identify this question
var qID = {QID};
var thisQuestion = $('#question'+qID);
// Remove LS imposed column widths
$('colgroup', thisQuestion).remove();
// Move the table cells
$('table.subquestion-list thead tr', thisQuestion).each(function(i, thisRow) {
$('td.header_separator', thisRow).after($('th.header_answer_text', thisRow)).remove();
});
$('tr.answers-list', thisQuestion).each(function(i, thisRow) {
$('td.dual_scale_separator', thisRow).after($('th.answertext', thisRow)).remove();
});
// Insert some clean-up styles (could be placed in template.css)
var newStyles = '<style type="text/css">\n'+
'#question'+qID+' th.header_answer_text, #question'+qID+' th.answertext {\n'+
'width:50%;\n'+
'text-align:center;\n'+
'hyphens: none;\n'+
'overflow-wrap: normal;\n'+
'}\n'+
'#question'+qID+' td.radio-item {\n'+
'padding: 10px;\n'+
'}\n'+
'#question'+qID+' .radio label::before, #question'+qID+' .radio label::after {\n'+
'margin-left: 0;\n'+
'}\n'+
'@media only screen and (max-width: 801px) {\n'+
'#question'+qID+' th.answertext {\n'+
'clear: both;\n'+
'text-align: left;\n'+
'}\n'+
'#question'+qID+' td.radio-item {\n'+
'float: left;\n'+
'width: auto !important;\n'+
'}\n'+
'}\n'+
'</style>'
$('head').append(newStyles);
});
</script>
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Thank you for your help! With your code the EM is now working. But the answers are no longer in the middle of the dual array. In my example both arrays are now identical. So there there is no difference in the result compared to just using the "standard" dual array without any javascript code.