views:

36

answers:

1

Hi, I have several jquery datepickers on my asp page and I want to set the defaultdate of date picker to be the same as the previous datepicker.

I am currently using

defaultDate: document.getElementById('<%=txtFirstDate.ClientID%>').value

This works okay, but obviously errors if firstDate is null. Should I be using OnSelect function instead?

Appreciate any help

A: 
var defaultDate = document.getElementById('<%=txtFirstDate.ClientID%>').value;

defaultDate: defaultDate || 'default-value'
alex
Thanks Alex. This method only works if txtFirstDate already has a value in it when I load the page. If txtFirstDate is null when I load the page and I select a value on its datepicker, the txtSecondDate will not pull through the txtFirstDate but rather default-value
Maton