- Posts: 20
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Multiple numerical input - Exclude prefix/suffix in max sum label?
- Magnar
- Topic Author
- Offline
- Junior Member
Less
More
6 years 3 months ago - 6 years 3 months ago #162451
by Magnar
Multiple numerical input - Exclude prefix/suffix in max sum label? was created by Magnar
I'm using the multiple numerical input question type with prefixes and suffixes and would like to preset a maximum sum value. The label in the question container that shows said value contains those prefixes/suffixes as well, though. Is there a way to hide or even disable them so that only the value is shown?
Attachments:
Last edit: 6 years 3 months ago by Magnar.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
6 years 3 months ago #162455
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 Multiple numerical input - Exclude prefix/suffix in max sum label?
I don't see any way to target that with CSS but placing this little script in the question source should do it:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:complete',function() { $('#question{QID} .multiplenumerichelp span[id^="totalvalue_"]').html($('#question{QID} .multiplenumerichelp span[id^="totalvalue_"] span[id^="LEMtailor_"]')); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: Magnar
The topic has been locked.
- Magnar
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 20
- Thank you received: 0
6 years 3 months ago - 6 years 3 months ago #162483
by Magnar
Replied by Magnar on topic Multiple numerical input - Exclude prefix/suffix in max sum label?
Nevermind, it works. Thank you very much for the quick response! It is kind of a bummer that this isn't possible through CSS though; giving those prefixes/suffixes a div and a class would make this so much easier and faster.
Would this also work with the template.js to affect all questions of this type? I'd rather not have other users play around with JS code in questions.
Would this also work with the template.js to affect all questions of this type? I'd rather not have other users play around with JS code in questions.
Last edit: 6 years 3 months ago by Magnar.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
6 years 3 months ago - 6 years 3 months ago #162485
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 Multiple numerical input - Exclude prefix/suffix in max sum label?
Yes, if placing the code in template.js, I would use this:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Remove text from total value elements $('.numeric-multi').each(function(e) { $('.multiplenumerichelp span[id^="totalvalue_"]', this).html($('.multiplenumerichelp span[id^="totalvalue_"] span[id^="LEMtailor_"]', this)); }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 3 months ago by tpartner.
The following user(s) said Thank You: Magnar
The topic has been locked.
- Magnar
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 20
- Thank you received: 0
6 years 3 months ago #162498
by Magnar
Replied by Magnar on topic Multiple numerical input - Exclude prefix/suffix in max sum label?
Amazing, thank you so much tpartner!
The topic has been locked.