I have an html input in which I want to save a time. For that I use the jquery datepicker but I can't get it to work for me. I would like that when clicking on the field, I only get the possibility to set the Time.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker3'>
<input type='text' class="form-control" />
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker3').datetimepicker({
format: 'LT'
});
});
</script>
</div>
</div>
You seemed to have a library problem, old versions trying to call new features. Apart from the problem of not assigning the
datetimepicker
to<input>
, as the colleague @Marcos tells you.I think this is more or less what you wanted to do.
The changes you should make are:
id
datetimepicker3
should be assigned toinput
format
could change it forH:i
datepicker: false
Example: