Manipulate Questions With JQuery
From LimeSurvey Manual
5 Point Choice
Reset Widget - Mandatory
$('#answerSGQAN').removeAttr('checked'); // for N=1-5 OR
$('#questionN').find('input').removeAttr('checked'); // where N is the question #
Reset Widget - Optional
$('#SGQANANS').attr('checked','checked');
Hide An Answer Choice
$('#answerSGQAN').parent().hide(); //since parent is the list item (li) entry
Null the Response
$('#javaSGQA').value=;
List Dropdown
Reset Widget
$('#answerSGQA').find('option').first().attr('selected','selected'); // OR
$('#questionN').find('option').first().attr('selected','selected'); // where N is the question #
Hide An Answer Choice
? Is this possible?
Null the Response
$('#javaSGQA').value=;
List Radio
Reset Widget - Mandatory
$('#questionN').find('input').removeAttr('checked'); // where N is the question #
Reset Widget - Optional
$('#answerSGQANANS').attr('checked','checked');
Hide an Answer Choice
$('#javatbdSGQAV').hide(); // where V is the code value for the answer
Null the Response
$('#javaSGQA').value=;
List with Comment
Reset Widget - Mandatory
$('#questionN').find('input').removeAttr('checked'); // where N is the question #
$('#questionN').find('textarea').val(); // blank the value of the comment
Reset Widget - Optional
$('#answerSGQA').attr('checked','checked');
$('#questionN').find('textarea').val(); // blank the value of the comment
Hide an Answer Choice
$('#answerSGQAN').parent().hide(); //since parent is the list item (li) entry
Null the Response
$('#javaSGQA').value=;
$('#answerSGQAcomment').val(); // blank hte value of the comment
Array (Flexible Row)
Reset Widget - Mandatory - All
$('#questionN').find('input').removeAttr('checked'); // where N is the question #
Reset Widget - Mandatory - One
$('#questionN').find('input[id
Reset Widget - Optional - All
$('#questionN').find('input[id$=-]').attr('checked','checked'); // where N is the question #
Reset Widget - Optional - One
$('#answerSGQASQ-').attr('checked','checked'); // where SQ is the subquestion code
Hide an Answer Choice (Column)
? Is this possible?
$('#questionN').find('td[class=answer_cell_00N]').hide(); // where N is the answer #. Note, this hides the check boxes but not the row header
Hide a Sub-Question (Row)
$('#questionN').find('tbody[id$=SQ]').hide(); // where SQ is the SubQuestion code