2011-01-17 18 views

cevap

12

Sen current date in JavaScript alabilirsiniz:

$('input.youTextFieldClass').datepicker({ dateFormat: 'mm/dd/yy', 
            changeMonth: true, 
            changeYear: true, 
            yearRange: '-70:+10', 
            constrainInput: false, 
            duration: '', 
            gotoCurrent: true}); 

If you want to set current date in textfields as page load:

$("input.youTextFieldClass").datepicker('setDate', new Date()); 
+3

Bu seçicide bir etiket adı atın ve daha hızlı çalışacaktır. ''.youTextFieldClass' öğesini' input.youTextFieldClass'' ile değiştirin. – chprpipr

2

Şunları bulabilirsiniz: jQuery DatePicker kullanıyorsanız

var now = new Date(); 

böyle herhangi textfield uygulayabilirsiniz örnek here.

<input type="text" id="datepicker"> 
$("#datepicker").datepicker({dateFormat:"dd M yy"}).datepicker("setDate",new Date()); 
İlgili konular