2013-06-09 12 views
5

पर आज का बटन चालू करें मैं इस स्रोत http://jqueryui.com/datepicker/#buttonbar से डेट पिकर का उपयोग कर रहा हूं, मैं बटन बार पर सक्रिय "बटन" बटन को सक्रिय करने की कोशिश कर रहा हूं, क्या कोई मेरी मदद कर सकता है।दिनांक पिकर

$(".datepicker").datepicker({ 
      showButtonPanel: true, closeText: 'Clear', 
      gotoCurrent : true, 
      changeMonth: true, 
      changeYear: true, 
      yearRange: '1900, 2300', 
      dateFormat: _DateFormatDatePicker,    
      onSelect: function (dateText, inst) { 
       dateAsString = dateText; //the first parameter of this function 
       var dateAsObject = $(this).datepicker('getDate'); //the getDate method 
       document.getElementById('<%=hdnTempDate.ClientID%>').value = dateText; 
      } 
+1

है कि आप जवाब देने के लिए मदद मिल सकती है मुझे http://api.jqueryui.com/datepicker/#option-currentText – Alaa

+0

वाट आप इसे हो रही द्वारा मतलब है " सक्रिय "? –

+3

ऐसा प्रतीत होता है कि यह आसान नहीं है, यहां एक नज़र डालें: http://stackoverflow.com/questions/1073410/today-button-in-jquery-datepicker-doesnt-work –

उत्तर

12

इस प्रयास करें:

$(".datepicker").datepicker({ 
    showOn: "button", 
    showButtonPanel: true, 
    buttonImage: buttonCalendar, 
    buttonImageOnly: true, 
    buttonText: "" 
}); 

और कॉल इस पृष्ठ पर जहाँ कैलेंडर में कोड जे एस। showButtonPanel: true:

$.datepicker._gotoToday = function(id) { 
    $(id).datepicker('setDate', new Date()).datepicker('hide').blur(); 
}; 
+0

'$ .datepicker._gotoToday = function (id) { $ (id) .datepicker (' सेटडेट ', नई तिथि()) डेटपिकर (' छुपाएं ')। धुंध(); }; ' –

+0

थोड़ा और सही है' $ (आईडी) .डेटपिकर ('सेटडेट', नई तिथि())। डेटपिकर ('छुपाएं')। धुंध()। बदलें(); ' – Kotodid

8

इस

$(function() { 
    $("#datepicker").datepicker({ 
     showButtonPanel: true 
    }); 
}); 
2

द्वारा बटन पैनल सक्षम करें की कोशिश करो। फिर अपने datepicker जे एस कोड के बाद निम्नलिखित कोड जगह:

var _gotoToday = jQuery.datepicker._gotoToday; 
jQuery.datepicker._gotoToday = function(a){ 
    var target = jQuery(a); 
    var inst = this._getInst(target[0]); 
    _gotoToday.call(this, a); 
    jQuery.datepicker._selectDate(a, jQuery.datepicker._formatDate(inst,inst.selectedDay, inst.selectedMonth, inst.selectedYear)); 
}; 
संबंधित मुद्दे