Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: problems with javascript

Re: problems with javascript 3 years 2 months ago #62449

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4180
  • Thank you received: 784
  • Karma: 358
If you want to do it to more questions on the same page, use something like the following.

The answer of question ID 11 will be piped into the text of questionID 22 and the answer of question ID 33 will be piped into the text of questionID 44.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		pipeText(11, 22);
		pipeText(33, 44); 
 
		function pipeText(q1ID, q2ID){
			$('#question'+q1ID+' input.radio').click(function(){
				$('#question'+q2ID+' .pipedText').text($(this).siblings('label').text());
			});
		}
 
	});
 
</script>


Add as many function calls as necessary:
		pipeText(11, 22);
		pipeText(33, 44);
		pipeText(55, 66);
		pipeText(77, 88);
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: mattias

Re: problems with javascript 3 years 2 months ago #62452

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
but my question is to work with different pages eg:

Page1

Q1 = Question 1
question 2

Q2 = the value of question 1 is: example (Question1)

page 2

Q3 = the value of question 1 is: example (Question 1)

I hope I have been more clear.

regards
The administrator has disabled public write access.

Re: problems with javascript 3 years 2 months ago #62472

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4180
  • Thank you received: 784
  • Karma: 358
For questions on subsequent pages you don't need JavaScript. You can use {INSERTANS} - docs.limesurvey.org/Adding+a+question&hi...rom_previous_answers.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: problems with javascript 3 years 2 months ago #62488

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
thanks friend solved the problem with what I stated.

regards
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.112 seconds
Donation Image