views:

90

answers:

0

Hi, I'm puzzled by the jQuery UI datepicker. I have the following function:

$(".text-date").datepicker({
 changeMonth: true,
 changeYear: true,
 dateFormat: "yy-mm-dd"
}); 

$("#regdatum input").change(function() {
    alert('Regdatum from: '+$("#filter-regdatum-from-value").val());
    alert('Regdatum to: '+$("#filter-regdatum-to-value").val());     
    if (($("#filter-regdatum-from-value").attr("value") != '') && ($("#filter-regdatum-to-value").attr("value") != ''))
    {
  generateDomainList();     
    }
});

Which attaches the click event to the input fields within a div #regdatum. The two alerts shown here return the date chosen in the input field through datepicker. When the two fields have a value it needs to execute function generateDomainList(). In this function I try to get the values of the same input fields using the method above:

$("#filter-regdatum-from-value").val()

But no matter what I do at this point it will return 'undefined' (not as a string) in my alert. It doesn't seem logical to me, can anyone tell me why this occurs and perhaps how to work around it?