Difference between revisions of "Reverse the position of the subquestion texts with their textboxes in the text-grid question"
CGHelpdesk (talk | contribs) |
CGHelpdesk (talk | contribs) |
||
Line 2: | Line 2: | ||
This guide will help you reverse the position of the subquestion texts with their textboxes in the text-grid question such as below images: | This guide will help you reverse the position of the subquestion texts with their textboxes in the text-grid question such as below images: | ||
+ | |||
+ | [[File:ReversePosition.jpg]] | ||
Put below javascript code snippet into your text-grid question. | Put below javascript code snippet into your text-grid question. |
Revision as of 10:42, 14 November 2013
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
};