- Posts: 5
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Generalize Java Script Workaround for removing comment text boxes
- Alexitktwfo
- Topic Author
- Offline
- New Member
Less
More
1 year 11 months ago #228175
by Alexitktwfo
Generalize Java Script Workaround for removing comment text boxes was created by Alexitktwfo
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.17.4+190529
Own server or LimeSurvey hosting: own
Survey theme/template: own based on fruity
==================
Hello,
I removed the comment boxes/text boxes from a multiple choice question with comment boxes with the following code below.
When creating a new survey that is a copy of the survey I would like the java script solution to still function without having to manually enter the survey id/question group id and question id into the js workaround in the question.
Can I generalise the solution by using #question{QID} somehow instead of id="answer37771X218X6777othercomment"
All the best and thank you.
Your LimeSurvey version: Version 3.17.4+190529
Own server or LimeSurvey hosting: own
Survey theme/template: own based on fruity
==================
Hello,
I removed the comment boxes/text boxes from a multiple choice question with comment boxes with the following code below.
When creating a new survey that is a copy of the survey I would like the java script solution to still function without having to manually enter the survey id/question group id and question id into the js workaround in the question.
Can I generalise the solution by using #question{QID} somehow instead of id="answer37771X218X6777othercomment"
All the best and thank you.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('input[id="answer37771X218X6777othercomment"]').remove(); $('input[id="answer37771X218X67771comment"]').remove(); }); </script>
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3965
1 year 11 months ago #228183
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Generalize Java Script Workaround for removing comment text boxes
Hi,
I do not know how old this code is
Here is another solution
On the other side you may use {SGQ}
Joffm
I do not know how old this code is
Here is another solution
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var thisQuestion = $('#question{QID}'); // Remove some text inputs $('.checkbox-text-item:eq(0) .comment-item', thisQuestion).remove(); $('.checkbox-text-item:eq(1) .comment-item', thisQuestion).remove(); $('.checkbox-text-item:eq(2) .comment-item', thisQuestion).remove(); $('.checkbox-text-item:eq(4) .comment-item', thisQuestion).remove(); $('.checkbox-text-item:eq(6) .comment-item', thisQuestion).remove(); }); </script>
On the other side you may use {SGQ}
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Alexitktwfo
Please Log in to join the conversation.
- Alexitktwfo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 1
1 year 11 months ago - 1 year 11 months ago #228196
by Alexitktwfo
Replied by Alexitktwfo on topic Generalize Java Script Workaround for removing comment text boxes
Thank you. That´s perfect!
Last edit: 1 year 11 months ago by Alexitktwfo.
Please Log in to join the conversation.