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

TOPIC: insert javascript

Re: insert javascript 2 years 4 months ago #80793

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
And if there are more than two questions as I add the identifier.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		var text = 'El número clientes en el pasillo debe ser mayor o igual al número de clientes siendo atendidos.';
		var pregunta1 = "#question124482";
		var pregunta2 = "#question124483";
 
		$('.numeric input.text').change(function(){
			if($('.numeric:eq(pregunta1) input.text').val() && $('.numeric:eq(pregunta2) input.text').val() && $('.numeric:eq(pregunta1) input.text').val() > $('.numeric:eq(pregunta2) input.text').val()) {
				alert (text);
				$(this).val('');
			}
		});
	});
 
</script>
Last Edit: 2 years 4 months ago by mattias.
The administrator has disabled public write access.

Re: insert javascript 2 years 4 months ago #80795

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
You are close:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		var text = 'El número clientes en el pasillo debe ser mayor o igual al número de clientes siendo atendidos.';
		var pregunta1 = "#question124482";
		var pregunta2 = "#question124483";
 
		$(''+pregunta1+' input.text, '+pregunta2+' input.text'').change(function(){
			if($(''+pregunta1+' input.text').val() && $(''+pregunta2+' input.text').val() && $(''+pregunta1+' input.text').val() > $(''+pregunta2+' input.text').val()) {
				alert (text);
				$(this).val('');
			}
		});
	});
 
</script>
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.
Last Edit: 2 years 4 months ago by tpartner.
The administrator has disabled public write access.

Re: insert javascript 2 years 4 months ago #80797

  • mattias
  • mattias's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 77
  • Karma: 1
thanks works great.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.150 seconds
Donation Image