javascriptjquerydatetimepickerjquerydatetimepicker

jQuery clockInput: Disable Clock Time Picker


I am using jQuery clockInput: Clock Time Picker what i want that in some cases i do not need to set time, so in that case i want to disable time selection and set by default time which i set.

Here are the link which i use https://www.jqueryscript.net/time-clock/Clock-Time-Input-Plugin-jQuery-clockInput.html

A simple code for the clock :

$(document).ready(function() {
   $("input[type=time]").clockInput(false);
});

How can i do this ?


Solution

  • There is no such option for this plugin, It mean the author didn't provide an option to make it disable but you can do it on your own by a simple css property. Just set data-disabled="disabled" attribute.

    $(document).ready(function() {
      $("input[type=time]").clockInput(false);
    });
    input[data-disabled="disabled"]+.jq-ci {
      pointer-events: none;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://www.jqueryscript.net/demo/Clock-Time-Input-Plugin-jQuery-clockInput/jquery.clockinput.js"></script>
    <link href="https://www.jqueryscript.net/demo/Clock-Time-Input-Plugin-jQuery-clockInput/jquery.clockinput.css" rel="stylesheet" />
    <input type="time" data-disabled="disabled" value="14:30:00" />