Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Reverse the position of the subquestion texts with their textboxes in the text-grid question

From Catglobe Wiki

Reverse the position of the subquestion texts with their textboxes in the text-grid question

This guide will help you reverse the position of the subquestion texts with their textboxes in the text-grid question such as below images:

Put below javascript code snippet into your text-grid question.

The function reverseQuestionTextsWithTextBoxes() requires the textbox width parameter. This function will do the reverse and set the textboxes' width to the specifed width.


function reverseQuestionTextsWithTextBoxes(textBoxWidth /*number type and required*/) {
 $('td.grid_subquestion_text').each(function() {
 $(this).parent().append(this); 
 $(this).prev()
 .removeAttr('width').css({'border-left':'none', 'border-right':'dotted 1px #ccc', 'width': (Number(textBoxWidth) + 10) + 'px' })
 .children('input:text').css('width', textBoxWidth + 'px');
 });
}

quest.onInit = function() {
 reverseQuestionTextsWithTextBoxes(150); // Reverse and set the textbox width to 150px
};