From .asp:
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
How can I add a date and time picker on this popup block?
From http://www.w3schools./bootstrap/bootstrap_modal.asp:
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
How can I add a date and time picker on this popup block?
Share Improve this question edited Dec 19, 2015 at 18:54 adrianbanks 83.1k23 gold badges178 silver badges208 bronze badges asked Dec 19, 2015 at 18:47 Rahul PrajapatiRahul Prajapati 4461 gold badge4 silver badges12 bronze badges2 Answers
Reset to default 3<div class="input-append date form_datetime">
<input size="16" type="text" value="" readonly>
<span class="add-on"><i class="icon-th"></i></span>
</div>
<script type="text/javascript">
$(".form_datetime").datetimepicker({
format: "dd MM yyyy - hh:ii"
});
</script>
Here is the demo http://www.malot.fr/bootstrap-datetimepicker/demo.php
- Above link throw download demo zip
- Extract zip file
- check demo in Extracted zip
- use in your web
- remove unnecessary jQuery / CSS / Javascript which conflict with your web CSS / Javascript / jQuery
In the body of the modal add the html for the input field and calendar icon like this:
<div class="input-group date" data-provide="datepicker">
<input type="text" class="form-control">
<div class="input-group-addon">
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
In your main.js file, master page, or even at page level, make the javascript call like this:
$('.datepicker').datepicker({
format: 'mm/dd/yyyy',
startDate: '-3d'
})
there are obviously other options to control your functionality and display including ranges. Read through the documentation to explore more options bootstrap-datepicker
And be sure you have JQuery.js, Bootstrap.js, and bootstrap-datepicker.js in that order being referenced in your page's head or bottom before closing your
Here is a demo.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743762713a4502928.html
评论列表(0条)