0

now, I am trying to disable the pick function for some reason, I just want to display the date/time, but it can't be done, it seems that there is no such option or function to reach this? Anyone has an idea why this is the case?

xjkms
  • 21
  • 6
  • You can use the built in Javascript function getTime() http://www.w3schools.com/jsref/jsref_gettime.asp – Ethan Fischer Feb 19 '16 at 09:38
  • Try attribute readonly="readonly" or $("#datetimepicker1").data("DateTimePicker").disable() – zamuka Feb 19 '16 at 09:41
  • I just want to make that widget readonly or disabled, but I can't make that happen. – xjkms Feb 19 '16 at 09:42
  • @zamuka it doesn't work, I have tried that way. – xjkms Feb 19 '16 at 09:43
  • $("#datetimepicker1").data("DateTimePicker").disable() works fine, but widget is grayed and button is still visible ( – zamuka Feb 19 '16 at 09:48
  • 1
    I guess this is what you are looking for http://stackoverflow.com/questions/21933728/how-to-make-bootstrap-datepicker-readonly good luck – Leeyung Feb 19 '16 at 09:51
  • @zamuka I get the DateTimePicker object, but there isn't any function named "disable", which version are you using? – xjkms Feb 19 '16 at 10:02
  • @Vinu sorry, the linked answer you gave is about "DatePicker", not for "DateTimePicker", – xjkms Feb 22 '16 at 06:32
  • here is my jsfiddle file, https://jsfiddle.net/xjkms/hzwpsnjw/1/, help me to disable the calendar widget. thanks for all your helps. – xjkms Feb 22 '16 at 06:35

1 Answers1

0

I find that in the latest version of datetimepicker, there is a option "ignoreReadonly", it's default value is false and we don't change it. Just to make add the readonly attribute to the input. Then we can disable the widget. In my old version, there is no such option. so, thanks for your answers and thanks Eonasdan. by the way, the version contains this option, is 4.14+. And you can view the demo by [disabled datetimepicker demo](https://jsfiddle.net/xjkms/hzwpsnjw/2/).

xjkms
  • 21
  • 6