Multiple numerical input - Exclude prefix/suffix in max sum label?

More
4 months 2 weeks ago - 4 months 2 weeks ago #162451 by Magnar
Magnar created the topic: Multiple numerical input - Exclude prefix/suffix in max sum label?
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: 4 months 2 weeks ago by Magnar.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #162455 by tpartner
tpartner replied the 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:

<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: LouisGac, Magnar

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago - 4 months 1 week ago #162483 by Magnar
Magnar replied the 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.
Last Edit: 4 months 1 week ago by Magnar.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago - 4 months 1 week ago #162485 by tpartner
tpartner replied the topic: Multiple numerical input - Exclude prefix/suffix in max sum label?
Yes, if placing the code in template.js, I would use this:

<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: 4 months 1 week ago by tpartner.
The following user(s) said Thank You: Magnar

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #162498 by Magnar
Magnar replied the topic: Multiple numerical input - Exclude prefix/suffix in max sum label?
Amazing, thank you so much tpartner!

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!