2010-02-02 39 views
0
$(document).ready(function(){ 
$('#data_nasterii').datepicker($.datepicker.regional['ro']); // romanian language 
$('#data_nasterii').datepicker('option', 'changeMonth', true); // dropdown with month 
$('#data_nasterii').datepicker('option', 'changeYear', true); // dropdown with year 
$('#data_nasterii').datepicker('option', 'yearRange', '1900:2020'); // selectable years 
$('#data_nasterii').datepicker('option', 'dateFormat', 'yy-mm-dd'); // date format(ex: 1981-07-25) 

}); 

... 
// creating date field with php 

echo "<td><div align=\"left\"><input name=\"data_nasterii\" type=\"text\" id=\"data_nasterii\" value=\"".$row['data_nasterii']."\" size=\"10\" maxlength=\"10\" /></div></td></tr>"; 

後,如果我打「清​​除表單」字段得到正確的值默認jQuery的日期值編輯表格,頁面加載

預先感謝您的jQuery設置當前日期場!

回答

0

設置選項的正確方法是不會像您一樣一再重複它們。

$(this).datepicker({ 
     showButtonPanel: true, 
     closeText: 'X', 
     dateFormat: 'mm/dd/yy', 
     buttonText: 'Select Date', 
     showOn: 'button', 
     duration: 'fast' 
    }); 

試着用這種格式來看看。 也嘗試不設置日期對象中的值,並嘗試在使用Java腳本進行頁面加載後進行設置。