apply timepicker to multiple textfields at once

More
4 years 6 months ago #90853 by Gabriela
Gabriela created the topic: apply timepicker to multiple textfields at once
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 6 months ago #90878 by tpartner
tpartner replied the topic: apply timepicker to multiple textfields at once
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 6 months ago - 4 years 6 months ago #90879 by tpartner
tpartner replied the topic: apply timepicker to multiple textfields at once
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 6 months ago by tpartner.

Please Log in to join the conversation.

More
4 years 6 months ago #90913 by Gabriela
Gabriela replied the topic: apply timepicker to multiple textfields at once
Thanks!! it works perfectly

Please Log in to join the conversation.

More
4 years 6 months ago #90915 by tpartner
tpartner replied the topic: apply timepicker to multiple textfields at once
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 months ago #90935 by Gabriela
Gabriela replied the topic: apply timepicker to multiple textfields at once
Have the feeling I will never be done... :blink:

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now