Using Javascript to add a function on survey - live feedback on hotspot question of number of selected items. | Experience Community
Skip to main content

Using Javascript to add a function on survey - live feedback on hotspot question of number of selected items.

  • March 30, 2026
  • 3 replies
  • 21 views

Forum|alt.badge.img+1

Hi everyone, 

I am designing a survey where participants will be randomly assigned to three conditions: Healthy, neutral and unhealthy. Within each condition default grocery items will be pre-selected, but the participant will have free will to add, change, delete or swap items as much as they like. 

 

I am seeking some javascript coding to add a feature that tells the participants how many items they currently have selected as they work their way through the grocery store categories. e.g if they start with 30 items in the cart as the default they will need to end with 30 items, not able to go over this limit. 

 

However, i want the participants to know how many items they currently have selected as they select and unselect items. 

 

Is this possible? can anyone help as i have no coding experience ?

 

thank you so much in advance !

3 replies

  • Level 4 ●●●●
  • March 30, 2026

can you show us, how the question is designed. That will be helpful.

 


Forum|alt.badge.img+1
  • Author
  • March 30, 2026

Thanks so much for your reply!

Here’s how my question is currently designed:

  • Each grocery category (e.g., bakery, dairy/eggs/fridge,  snacks, meat/alternatives) is presented as a hotspot format 
  • Participants can select multiple items within each category
  • In each condition (healthy, neutral, unhealthy), a set of items is pre-selected by default
  • Participants can freely:
    • Unselect default items
    • Select new items
    • Swap items within and across categories

Across all categories, participants must finish with exactly 30 items total.

What I’m trying to achieve:

  • Display a live counter (e.g., “You have selected 24 / 30 items”)
  • Update the count dynamically as participants select/unselect items across questions
  • Ideally prevent them from selecting more than 30 items total

Current structure:

  • Each category is a separate question on its own page
  • Using standard multiple choice (checkbox) questions
  • No JavaScript added yet

My main challenge is:
 I’m not sure how to track selections across multiple questions/pages in real time, or whether this requires Embedded Data + JavaScript.

 

let me know if u need any more information 


Forum|alt.badge.img+1
  • Author
  • March 30, 2026

if not on hotspot style question, can it be done on multiple choice question style ?