In the below picture I have added javascript such that if you select y for a then x also gets selected for a and similarly for b and c. Now the respondent can deselect the selection of x (as done for c) but after deselecting x for c they are not able to select x again. How do I do that using javascript. Thank you for the help in advance!!!
Here is the Javascript I used
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery('input[type="checkbox"]').change(function(){
if ( jQuery("[id='QR~QID6~1~2']").is(":checked"))
{jQuery("[id='QR~QID6~1~1']").prop('checked',true)}
if ( jQuery("[id='QR~QID6~2~2']").is(":checked"))
{jQuery("[id='QR~QID6~2~1']").prop('checked',true)}
if ( jQuery("[id='QR~QID6~3~2']").is(":checked"))
{jQuery("[id='QR~QID6~3~1']").prop('checked',true)}
});
});
You will need to update it via tbody tr like below:
jQuery('.QuestionBody').find('ul li').change(function()
{
if (jQuery(this).find('inputttype="checkbox"]').eq(1).is(':checked')) {
jQuery('.QuestionBody .ChoiceStructure').find('tbody tr td').find('inputttype="checkbox"]').eq(0).prop('checked',true)}
});
https://community.qualtrics.com/XMcommunity/discussion/comment/39055#Comment_39055hi, this doesn't seem to work! Could you explain what exactly it does as my javascript is a bit weak!
You have used qids and hence would require to write if logic for every scenario, the best would be write .click() or .change() function which would save your time. Do update the code accordingly, and try to break the code piece by piece; that might help.
I just placed the code in onload and that seems to be working for me
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.