Check out the LimeSurvey source code on GitHub!

prefill answer of single choice via js

More
5 years 11 months ago #56081 by KRav
hi, I'm wodering, how to prefill a single choice answer via js?
this is not working :


<script type="text/javascript" charset="utf-8"> jQuery(document).ready(function($) { var role = '{INSERTANS:54579X4X39}'; document.getElementById('answer54579X20X244').value= 'A2'; // or '{A1}' is not working } }); </script> code][code]
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function($)
{
var role = '{INSERTANS:54579X4X39}';
document.getElementById('answer54579X20X244').value= 'A2'; // or '{A1}' is not working
}

});
</script>

code]


research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in to join the conversation.

More
5 years 11 months ago #56095 by DenisChenu
Hello,

You have to use .attr jquery function.

Without testing:
$("input#answer54579X20X244A2").attr('checked', true);

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
5 years 11 months ago #56157 by KRav
Thanks


research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in to join the conversation.

More
5 years 11 months ago #56178 by Mazi
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form