I just can't find a way to submit a form after selecting a date via bootstrap 3 datetimepicker (Eonasdan) without having to click a button. I wonder if it is possible. Please, have a look at my code.
<div class="container">
<div class="row">
<div class='col-md-3'>
<form action="date.php" method="post" class="form">
<div class="form-group">
<div class='input-group dp1'>
<input type='text' class="form-control" name="startdate" id="start" >
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
<button class="btn btn-primary">submit</button>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<p>
Startdate is <?php echo $startdate; ?>
</p>
</div>
</div>
</div>
And here is the JS code:
<script type="text/javascript">
$(function () {
$('.dp1').datetimepicker({
format: 'DD-MM-YYYY',
showTodayButton: true
});
$("#dp1").on("change.dp", function() {
$('.form').submit();
});
});
</script>
I would appreciate any help or suggestion!