- Posts: 11
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Get the number of questions on the current page
- RautenkinG
- Topic Author
- Offline
- New Member
Less
More
6 years 8 months ago #157852
by RautenkinG
Get the number of questions on the current page was created by RautenkinG
Hey Guys,
quick question.
On my page i have four 5 star rating question. They appears if on the previous sites their checkboxes are checked.
Since i have something like this before evry quesiton "1) .... 1.1) .... 2) ...." I wish i could do it with them aswell, but since i never know how many of them will appear i wont know which number i should give them.
Is there a .js solution for it which counts how many question on this page appears so i can use this to set the "x.y)" number of the question with it?
Greetings
Steffen
quick question.
On my page i have four 5 star rating question. They appears if on the previous sites their checkboxes are checked.
Since i have something like this before evry quesiton "1) .... 1.1) .... 2) ...." I wish i could do it with them aswell, but since i never know how many of them will appear i wont know which number i should give them.
Is there a .js solution for it which counts how many question on this page appears so i can use this to set the "x.y)" number of the question with it?
Greetings
Steffen
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10116
- Thank you received: 3597
6 years 8 months ago - 6 years 8 months ago #157858
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Get the number of questions on the current page
1) Insert a span element into the text of every question something like this:
2) Place this script in the source of the first question:
Code:
2.<span class="q-number"></span>) Some question text...
2) Place this script in the source of the first question:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('.question-container:visible').each(function(i) { $('.q-number', this).text(i+1); }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 8 months ago by tpartner.
The topic has been locked.
- RautenkinG
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
6 years 8 months ago #157859
by RautenkinG
Replied by RautenkinG on topic Get the number of questions on the current page
worked perfectly, ty very much!
The topic has been locked.