Datepicker onfocus Event in jquery

I need to show datepicker onfocus Textbox event in Jquery. Here's the code but not working

$("#payment_date").focus(function() {
 $("#payment_date").datepicker("show");
}); 

      

+3


source to share


2 answers


The DatePicker in jQuery UI automatically binds to the focus of the input element. You don't need to link it again.

Just works:



$(function() {     
    $('#payment_date').datepicker();
});

      

Should be enough.

+2


source


$("input[id$=datepicker]").datepicker({});

      



Try this, it works great.

+1


source







All Articles