Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One method to prevent clicking on an image button for a jQuery datePicker is to disable the button using jQuery code. Below is an example code snippet to disable the image button:

$(document).ready(function(){
  $("#datepicker").datepicker();
  $(".ui-datepicker-trigger").click(function(){
    return false;
  });
});

Here, we select the image button which triggers the datePicker using .ui-datepicker-trigger class and bind a click event to it using the .click() function. Inside the event handler function, we return false which prevents the default click action of the button.