Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Alert on each checkbox when checked

  • amritdeep
  • amritdeep's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 11 months ago #136288 by amritdeep
Alert on each checkbox when checked was created by amritdeep
Need Javascript code:
My question is Multi Select type

Que1: What is the reason ??
Ans Options :
1. This is not my primary residence
2. I am not interested
3. I am sick

whenever the user select any option an alert box will appear with message.
Like: if(user select option 1){ alert ("option 1 is selected") }
if(user select option 2){ alert ("option 2 is selected") }
if(user select option 3){ alert ("option 3 is selected") }


and so on....
Note: Ans options are Checkbox type (select multiple values)
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 11 months ago - 7 years 11 months ago #136293 by DenisChenu
Replied by DenisChenu on topic Alert on each checkbox when checked
Don't really understand why you need this .....

But , something like this :
Code:
<script>
$(document).on("click","#question{QID} input[radio]",function(){
alert($(this).closest(".checkbox-item").find(".label-text").text());
});
</script>

In the question source (and if you use 2.50). If you use 2.06 or before :
alert($("label").attr("for",$(this).attr("id")).text());

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 7 years 11 months ago by DenisChenu. Reason: [code]
The topic has been locked.
  • amritdeep
  • amritdeep's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 11 months ago - 7 years 11 months ago #136314 by amritdeep
Replied by amritdeep on topic Alert on each checkbox when checked
Q5. Would you mind telling me why you don’t want to participate? [MULTI SELECT OPTION]

❍ I am not interested in seeking health care =>Alert: « That’s OK ; we want to learn about the community’s general health needs and priorities. Even if you’re not interested in seeking health care right now, that’s also valuable information for us. »
❍ I have a sick relative and cannot leave them to participate => Alert: « We can talk in their presence and I’ll be happy to take breaks as you need to attend to them. I can also come back at a time when someone else is around to help. »
❍ I am watching my children and cannot leave them to participate =>Alert: « We can talk in the presence of children and I’ll be happy to take breaks as you need to attend to them.»



As shown above, When ever user select 1st option there will be a alert box with message (Define next to the option)
Last edit: 7 years 11 months ago by amritdeep.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 11 months ago #136315 by DenisChenu
Replied by DenisChenu on topic Alert on each checkbox when checked
No need js here

Add 3 question "show text" type, all with specific condition according to you need.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: tpartner
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose