Bootstrap datepicker example text input with specifying date format

Bootstrap datepicker example text input with specifying date format

In this post we will give you information about Bootstrap datepicker example text input with specifying date format. Hear we will give you detail about Bootstrap datepicker example text input with specifying date formatAnd how to use it also give you demo for it if it is necessary.

In this tutorial you will know how to use simple datepicker in your form. Using datepicker, you can easily choose the date from a calendar instead of typing manually.Here in below example we use bootstrap datepicker which is going most popular and has full-featured libraries.

The following example will tell you how to set datepicker using bootstrap datepicker.

  1. <html>
  2. <head>
  3. <title>Bootstrap datepicker example text input with specifying date format</title>
  4.     <linkhref="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"rel="stylesheet">
  5. <linkhref="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css"rel="stylesheet">
  6. <scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
  7. <scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  8. <scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script></head>
  9. <body>
  10. <inputclass="form-control"type="text"placeholder="click to show datepicker"id="example1">
  11. <scripttype="text/javascript">
  12. // When the document is ready
  13. $(document).ready(function () {
  14. $('#example1').datepicker({
  15. format: "dd/mm/yyyy"
  16. });
  17. });
  18. </script>
  19. </body>
  20. </html>
<html>
    <head>
     <title>Bootstrap datepicker example text input with specifying date format</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">  
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">  
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>  
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script> </head>
    <body> 
        <input   type="text" placeholder="click to show datepicker"  id="example1">
       
        <script type="text/javascript">
            // When the document is ready
            $(document).ready(function () {
                
                $('#example1').datepicker({
                    format: "dd/mm/yyyy"
                });  
            
            });
        </script>
 </body>
 </html>


If you need to auto closing the date picker which means datepicker immediately closed after choosing a date then you will have to set autoclose true :

  1. $('#example1').datepicker({
  2. autoclose:true,
  3. format:"dd/mm/yyyy"
  4. });
$('#example1').datepicker({
    autoclose: true,  
    format: "dd/mm/yyyy"
}); 


You can use bootstrap datepicker in your form where you need to show datepicker to make form interactive.



Show Demo

Label :

PHP

HTML

jQuery

How To

CSS

Web Development

Bootstrap

JavaScript

Hope this code and post will helped you for implement Bootstrap datepicker example text input with specifying date format. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

60  +    =  67

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US