Check and uncheck with code

More
3 years 8 months ago #105756 by SurveyDennis
SurveyDennis created the topic: Check and uncheck with code
Hi,

I am using an image and depended on the areas selected on that image I would like to get the answer 'punched'.

All working with some old code, however not anymore.

I probably only have a setting wrong in the coding.
Checking is working however unchecking not.
Maybe somebody spots it already:

if (alt === 'head') {
   if ( $('#answer313628X20X42A1').attr('checked') == true){
   $('#answer313628X20X42A1').attr('checked',false);
   }
   else {
   $('#answer313628X20X42A1').attr('checked',true);
   }
} 
 


In the demo below only the left image is working and then only the areas in the head.

survey

Many thanks, dennis

Be SurveyFriendly too
SurveyFriendly Designer [at] SurveyFriendly [dot] com

Please Log in to join the conversation.

More
3 years 8 months ago - 3 years 8 months ago #105768 by SurveyDennis
SurveyDennis replied the topic: Check and uncheck with code
this post can be closed, sorry for asking I found the solution in the meantime.

it worked with the .prop

   if ($('#answer313628X20X42A1').is(':checked')) {
       $( '#answer313628X20X42A1' ).prop( "checked", false );
   }
   else {
       $( '#answer313628X20X42A1' ).prop( "checked", true );
   }

Be SurveyFriendly too
SurveyFriendly Designer [at] SurveyFriendly [dot] com
Last Edit: 3 years 8 months ago by SurveyDennis.

Please Log in to join the conversation.

More
3 years 8 months ago #105777 by Ben_V
Ben_V replied the topic: Check and uncheck with code
Hi Dennis,

I'm glad that your "body image map" question is now working fine.
It would be very nice if you can provide an export and/or hints, because it will be very useful for other users using limesurvey for rheumatology assessment or research.

Ben.

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

More
3 years 8 months ago #105778 by SurveyDennis
SurveyDennis replied the topic: Check and uncheck with code
Hi Ben,

Yes for sure, I make sure to document this in the weekend and share it here!

Dennis

Be SurveyFriendly too
SurveyFriendly Designer [at] SurveyFriendly [dot] com
The following user(s) said Thank You: Ben_V

Please Log in to join the conversation.

More
3 years 8 months ago #105783 by SurveyDennis
SurveyDennis replied the topic: Check and uncheck with code
I have added some documentation about this on my site - feel free to copy and paste it.

Howto define areas on image and use them as answers:
Quick howto

Demo:
Demo

Be SurveyFriendly too
SurveyFriendly Designer [at] SurveyFriendly [dot] com

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!