Using jQuery Date picker with a custom trigger button

There's built-in support for this, having an icon or button to right right of the textbox, like this:

$("#datepicker").datepicker({
  showOn: 'button',
  buttonImage: 'images/calendar.gif',
  buttonImageOnly: true
});

If you want to show it from another button, or really any event, call the show method, like this:

$("#myButton").click(function() {
  $("#datepicker").datepicker("show");
});

You can try it here


I have solved using focus.

$("#datepicker").datepicker();

$("#myButton").click(function() {
 $("#datepicker").focus();
});

The samples page as an example of how to make the datpicker appear by clicking an icon:

here