Hi,
I want to hide certain cells in a series of constant sum matrix tables. I have looked at other threads posted on the community and I am using the below code to hide the cells that I don't want the respondent to answer -
Qualtrics.SurveyEngine.addOnload(function()
{
$('QR~QID10~1~4').up('td').childElements().invoke('hide');
$('QR~QID10~2~4').up('td').childElements().invoke('hide');
});
When I preview the question the cells are hidden as I planned but when I preview the full survey, the javascript doesn't appear to work. Looking at the developer console on Chrome I have a lot of errors on the page which I have attached.
error text.txtIs this an error with my code or something else? It is strange that it works when previewing the question but not during the full preview. Any help would be greatly appreciated.
You need to use the jQuery selector instead of $ and you will have to specify if it is class (using .) or id (using .
Use the below code to hide the specific element in your question, just change the index number (eq) from the below code.
//First row second element
jQuery('tbody tr:eq(0)').find('td:eq(1)').find('input').css('display','none')
// Second row first element
jQuery('tbody tr:eq(1)').find('td:eq(0)').find('input').css('display','none')
// first row first element
jQuery('tbody tr:eq(0)').find('td:eq(0)').find('input').css('display','none')
https://www.qualtrics.com/community/discussion/comment/27553#Comment_27553Thanks Suraj, that seems to have done the trick.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.