Edit html table, if multiple choice is checked with javascript

More
4 months 4 days ago - 4 months 4 days ago #157478 by medveyt
medveyt created the topic: Edit html table, if multiple choice is checked with javascript
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):
<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
Attachments:
Last Edit: 4 months 4 days ago by medveyt.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!