javascript - Bootstrap 3 Datetimepicker auto submit -
i can't find way submit form after selecting date via bootstrap 3 datetimepicker (eonasdan) without having click button. wonder if possible. please, have @ 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 <?php echo $startdate; ?> </p> </div> </div> </div>
and here js code:
<script type="text/javascript"> $(function () { $('.dp1').datetimepicker({ format: 'dd-mm-yyyy', showtodaybutton: true }); $("#dp1").on("change.dp", function() { $('.form').submit(); }); }); </script>
i appreciate or suggestion!
try
$("#dp1").on("dp.change", function() { $('.form').submit(); });
the current version had reverted due bug. docs have been updated.
Comments
Post a Comment