Ask Your Question
1

What is the method to prevent clicking on an image button for a jquery datePicker?

asked 2022-12-19 11:00:00 +0000

nofretete gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-11-08 04:00:00 +0000

bukephalos gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-12-19 11:00:00 +0000

Seen: 10 times

Last updated: Nov 08 '21