Page 1 of 1

date picker: set value

Posted: Mon May 14, 2012 1:15 pm
by janick.eisert

How can I set a date in the date picker? I've tried this, but I can only set the value attribute which is not used (always empty after choosing a date):

$(".datePicker").find('input').attr('value', '2012-05-14');

Thanks for your help!


date picker: set value

Posted: Mon May 14, 2012 4:05 pm
by maxkatz

What do you mean it's always empty after choosing a date..?


date picker: set value

Posted: Mon May 14, 2012 4:11 pm
by janick.eisert

After selecting a date in the date picker, the value attribute of the input tag has no value/is empty.


date picker: set value

Posted: Mon May 14, 2012 4:33 pm
by maxkatz

You set the date via calendar popup, date is set into the input field and then you want to read the value with JavaScript?


date picker: set value

Posted: Mon May 14, 2012 4:35 pm
by janick.eisert

Yes. I want to know how to read and set the value with JavaScript.


date picker: set value

Posted: Mon May 14, 2012 4:55 pm
by maxkatz

Something is wrong with the selector, this works:

code
$('input').attr('value', '2012-05-14');
/code