javascript - How can I clear input text on datetimepicker? -


demo , full code :

https://jsfiddle.net/oscar11/yfjvd200/

i want datepicker , timepicker not filled when loaded first time. want datepicker or timepicker filled when user clicks on input text of each. eg user click on timepicker text input time filled

i try use :

  $('#datepicker').val("");   $('#timepicker').val(""); 

but not work

how can it?

you found right trick!

$('#datepicker').val(""); $('#timepicker').val(""); 

but not doing @ right moment. place after pickers have been instanciated.

to fill time on focus, add .on() timepicker:

$('#timepicker').datetimepicker({   mindate: moment().add(300, 'm'), })   .on('focus', function(e){   if( $(this).val() == "" ){     $(this).data("datetimepicker").mindate(moment().add(300, 'm'));   } }); 

fiddle


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -