How to embed a color picker as question? | XM Community
Skip to main content
Dear Community! I wonder if it's possible to embed a RGB/HSV color picker as a question. In my survey the participants shall be asked to pick a color from a palette and the value (or at least the HEX codes) of the selected colour shall be saved. It is my first survey, I am really not experienced in these kinds of things. I would appreciate your help very much! Thanks!
It would be a little tedious, but you can do this with hot spot question type. Each color would be a separate zone.



You can also do it with a hot spot question, so that the respondent doesn't see the zone you created (in case it doesn't look good).
Reading up on this, there is probably a MUCH better way to do this with a JQuery. @TomG is a pretty good resource.
@overtone,



See this thread:

https://www.qualtrics.com/community/discussion/comment/7727#Comment_7727
Thank you TomG! It works perfectly!
> @overtone said:

> Thank you TomG! It works perfectly!



@Shashi deserves the credit. Be sure to give his answer an upvote.

Hi @TomG @overtone. I am not sure I can still find the original comment in hte thread you linked here as answer. Any advice on how to have color picker as question? thanks


Hi @TomG and @overtone 

 

I am looking at this conversation thread and would like to know how embed a question to pick a colour into our survey.  The thread seems to have disappeared.  Could you point me in the right direction to find it?

Thank you

Tracey


In a form field question with two fields, use the below script:

var cinput = jQuery("#"+this.questionId+" .InputText:eq(1)");
var hinput = jQuery("#"+this.questionId+" .InputText:eq(0)");
hinput.attr("readonly","readonly").css({"pointer-events":"none"});
cinput.attr("type","color").css({"width":"10%","height":"45px"});
cinput.change(function() {
const color = jQuery(this).val(); // Get the selected color value
hinput.val(color);
});

Output:

 


Thank you @Shashi.

 

So to clarify, each participant can choose a colour for the background?

 

Thank you so much.

 

Tracey


Leave a Reply