How would I count the amount of times participants pressed a button? | XM Community
Skip to main content
Solved

How would I count the amount of times participants pressed a button?

  • April 13, 2020
  • 6 replies
  • 172 views

how to get the equivalent of "button counts," perhaps by having people press the button each time a target thoughts goes through their mind for a limited period (e.g., 3 minutes)

Best answer by TomG

Use a click event. For example:
var count = 0;
jQuery("#myButton").click(function() {
count++;
Qualtrics.SurveyEngine.setEmbeddedData("count", count);
}); 

6 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • April 13, 2020

Are you referring to a keyboard button or an html button? Either way, you do it with a JS event listener, but they are two different events.


html button
I don't know how to code.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • April 13, 2020

Use a click event. For example:
var count = 0;
jQuery("#myButton").click(function() {
count++;
Qualtrics.SurveyEngine.setEmbeddedData("count", count);
}); 


Actually, I haven't figured out how to make the button, yet, so I don't know if it's html or not.


rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • April 14, 2020

You can create a button using HTML view of question :


See "How would I create a button to go with this question?"