Page 1 of 1

How can I read the input from a datepicker and use it in JS?

Posted: Thu Oct 30, 2014 10:19 am
by Fellrad

Hello!

I have seen that similar questions have been asked in this forum (some quite a while ago, however), but neither answer helped me.

It is simple: There is a datepicker component on my page and I want to read the date input done by the user and do something with it in JS. I have the following code running after some "send date" button has been clicked:

var x = Apperyio("datepickerComponentName").val();
alert (x);

The alert only shows an empty box, but I would like to see the date, i.e. 18/03/2014. What might be wrong?

Thanks for your help.


How can I read the input from a datepicker and use it in JS?

Posted: Thu Oct 30, 2014 1:13 pm
by Maryna Brodina

Hello!

Please use the following code:
prevar x = $("[name=datepickerComponentName] input").val();/pre


How can I read the input from a datepicker and use it in JS?

Posted: Thu Oct 30, 2014 3:54 pm
by Fellrad

Hi Maryna,

Thanks for your suggestion. It works perfectly. I appreciate your quick support.