Welcome to the LimeSurvey Community Forum

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

Edit html table, if multiple choice is checked with javascript

  • medveyt
  • medveyt's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago - 6 years 7 months ago #157478 by medveyt
Hi there!

I'm using limesurvey for some time, but quite new to ,,hack" it with javascript.

I'm trying to create a table, which will be updated, if the multiple choice question below is checked.

E.g.:
The table before the click
|| option 1| option 2| option 3
| question 1|||



Multiple choice question:
Is question 1...
... option 1? (checked)
... option 2? (not checked)
... option 3? (checked)

Then, the table should look like something like this:
|| option 1| option 2| option 3
| question 1| x|| x

I was trying to achieve this with javascript (for question 1 option 1 to do the X):
Code:
<script type="text/javascript">
$(document).ready(function(){
  var y=document.getElementById("q1o1");
  $('input.checkbox').click(function(e){
    if($('#answer482695X397X122631').is(':checked')) {
      y.innerhtml("x");
    }
});
</script>

But I'm not sure, if this is the right way. As i said, i'm quite new to js, so maybe it's all wrong.

I'm open to any suggestions and grateful for any help/solutions provided!

I've attached the test survey (

File Attachment:

File Name: limesurvey...2695.lss
File Size:20 KB
). I'm using 2.06+ Build 151018.

Have a nice day:
Thomas
Last edit: 6 years 7 months ago by medveyt.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose