Fellrad
Posts: 0
Joined: Wed Oct 15, 2014 9:06 am

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

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.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

Hello!

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

Fellrad
Posts: 0
Joined: Wed Oct 15, 2014 9:06 am

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

Hi Maryna,

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

Return to “Issues”