Check out the LimeSurvey source code on GitHub!

apply timepicker to multiple textfields at once

More
4 years 1 week ago #90853 by Gabriela
Hi all

trying to apply timepicker function to various answer fields, using just one function code...

no java knowledge, I tried this but not working..

$(document).ready(function(){

var answerArray="#answer97841X5X16SQ001_SQ002,#answer97841X5X16SQ002_SQ002,#answer97841X5X16SQ003_SQ002".split(',');


$(answerArray).timepicker({
timeText: 'Hora',
hourText: 'hora',
minuteText: 'minutos',
closeText: 'Fechar'

});



$(answerArray).attr('readonly', 'readonly');


});
</script>

Please, can you explain what im doing wrong?

thanks.

Please Log in to join the conversation.

More
4 years 1 week ago #90878 by tpartner
Have you included the timepicker plugin in your template?

Cheers,
Tony Partner

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

Please Log in to join the conversation.

More
4 years 1 week ago - 4 years 1 week ago #90879 by tpartner
If you have included the plugin ( fgelinas.com/code/timepicker/ ), try this:
$(document).ready(function(){
	var timeAnswers =$('#answer97841X5X16SQ001_SQ002, #answer97841X5X16SQ002_SQ002, #answer97841X5X16SQ003_SQ002');
 
	$(timeAnswers).timepicker({
		timeText: 'Hora',
		hourText: 'hora',
		minuteText: 'minutos',
		closeText: 'Fechar'
	}).attr('readonly', 'readonly');
});

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 4 years 1 week ago by tpartner.

Please Log in to join the conversation.

More
4 years 6 days ago #90913 by Gabriela
Thanks!! it works perfectly

Please Log in to join the conversation.

More
4 years 6 days ago #90915 by tpartner
Yeah, it's going to be quite a survey when you're done :cheer:

Cheers,
Tony Partner

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

Please Log in to join the conversation.

More
4 years 6 days ago #90935 by Gabriela
Have the feeling I will never be done... :blink:

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form