reverse order of options according to device type | XM Community
Skip to main content

Hello!

We have a 1-5 scale in a CES question and we would like it to have the 5 on the top for mobile and the 5 to the right in desktop. For example, if we use the 1-5 order, we have the right view in desktop (1 to the left and 5 to the right) but not in mobile. 

Is it possible to define the order based on the device type? 

Thanks!

Hi, try using this script developed by TomG. I found it in this post


It worked perfectly!!

Would you mind giving me a really simple explanation of whar does the code do? or how does it work? I was expecting some “device type” variable or something like that but I don’t really understand what is happening there 😅

Than you so much, @Tom_1842 


In that other thread, TomG mentions how the mobile view turns the answer choices to vertical:

In HTML, the choices are a table row with cells in left to right order. To make it vertical Qualtrics uses a @media CSS rule so when the screen width is 480px or less it changes the cells to display:block which makes them vertical but doesn't change the order.

In TomG’s JavaScript, the first 2 lines look for the table row and the answer choices.

If the answer choices are set to display:block (which only happens if they are displayed vertically with mobile), then loop through each cell and 'prepend' them to the table row. As each choice gets prepended, it gets placed at the beginning of the list, finishing with the last answer option which then displays first to the respondent.


It’s very clear now, thank you again for taking the time to explain this. 

Have a nice day!


Leave a Reply