{"id":16506,"date":"2017-03-13T16:15:13","date_gmt":"2017-03-13T14:15:13","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=16506"},"modified":"2018-01-08T13:13:14","modified_gmt":"2018-01-08T11:13:14","slug":"bootstrap-datepicker-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/","title":{"rendered":"Bootstrap Datepicker Example"},"content":{"rendered":"<p>In today&#8217;s article, we will be looking into how to get started quickly with Bootstrap&#8217;s datepicker, and explore a few of the different options, methods and events that are available. To follow this example, all you need is a text editor; I will be using Notepad++.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;57DHuNTHJ2qczaGz&#8217;]<br \/>\n&nbsp;<\/p>\n<h2>1. Introduction<\/h2>\n<h3>1.1. Date what?<\/h3>\n<p>If you&#8217;re building a website that at some stage, needs to allow the user to select one or several dates, then you&#8217;ll need to use what&#8217;s called a datepicker. A datepicker, to simply put it, is a nice little calendar widget, which allows the user to browse a calendar and select one or several dates. Today, we&#8217;ll be looking into Bootstrap&#8217;s implementation of the datepicker.<br \/>\nUsing Bootstrap&#8217;s date picker isn&#8217;t as straightforward as using other Bootstrap components, because it&#8217;s not included in the core library. You&#8217;ll need to include additional dependencies to be able to use it. Besides that, it&#8217;s pretty much the same as all the other components.<\/p>\n<h3>1.2. Who should read this article?<\/h3>\n<p>The goal of this article is to get developers or architects started on Bootstrap&#8217;s datepicker quickly. Most other datepicker references on the web &#8211; including the documentation &#8211; are complete, but hard to get into. This article aims to get you started fast and easily, for the scope of a POC or a simple requirements application.<\/p>\n<h3>1.3. Before we get started&#8230;<\/h3>\n<p>A few things I like to make clear in my articles:<br \/>\n&#8211; In Bootstrap projects, I prefer to use data-* attributes rather than use JavaScript. When creating a UI in HTML, it usually makes more sense to&#8230;uh&#8230;not use JavaScript. So I&#8217;m going to be using Bootstrap&#8217;s data-* attributes on my HTML tags; just know that it can be done in JavaScript as well.<br \/>\n&#8211; I always cut down my code examples down to the absolute bare minimum, to remove any clutter and make my example as clear and concise as possible. The goal in my articles isn&#8217;t to create beautiful web pages, it&#8217;s to demonstrate how a given feature is used.<br \/>\nNuff said. Let&#8217;s get our hands dirty.<\/p>\n<h2>2. Getting started<\/h2>\n<p>Let&#8217;s start by setting up the dependencies we need. You&#8217;ll notice we&#8217;ve included all the libraries required for a standard Bootstrap project (Bootstrap JS, CSS and jQuery), as well as two new ones: Bootstrap datepicker JS and CSS.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Datepicker setup.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;!-- Bootstrap JS and CSS + jQuery --&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n\t&lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n\t&lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n\t\r\n\t&lt;!-- Bootstrap datepicker JS and CSS --&gt;\r\n\t&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/js\/bootstrap-datepicker.js\"&gt;&lt;\/script&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/css\/bootstrap-datepicker.css\"&gt;&lt;\/link&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Now, let&#8217;s create a datepicker. Unlike most Bootstrap components (and this is important!), you&#8217;ll need to explicitly instantiate the datepicker yourself. This can be done in two ways:<br \/>\n&#8211; Either you can add a <b>data-provide<\/b> attribute to the HTML tag you wish to instantiate a datepicker on, associated to the value <b>datepicker<\/b><br \/>\n&#8211; Or you can use JavaScript to instantiate that same tag using the <b>datepicker()<\/b> method.<br \/>\nSee examples below.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Instantiate with data attributes.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Instantiate a datepicker with data-provide attribute&lt;\/title&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n\t&lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n\t&lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n\t\r\n\t&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/js\/bootstrap-datepicker.js\"&gt;&lt;\/script&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/css\/bootstrap-datepicker.css\"&gt;&lt;\/link&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;input type=\"text\" data-provide=\"datepicker\" \/&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>Instantiate with JavaScript.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&lt;\r\n&lt;html&lt;\r\n&lt;head&lt;\r\n\t&lt;title&lt;Instantiate a datepicker with JavaScript&lt;\/title&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&lt;&gt;\/link&gt; \r\n\t&lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&lt;&lt;\/script&gt;\r\n\t&lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n\t\r\n\t&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/js\/bootstrap-datepicker.js\"&gt;&lt;\/script&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/css\/bootstrap-datepicker.css\"&gt;&lt;\/link&gt;\r\n\t\r\n\t&lt;script&gt;\r\n\t\tfunction instantiateMyDatePicker() {\r\n\t\t\t$('#myDatePickerId').datepicker();\r\n\t\t}\r\n\t&lt;\/script&gt;\r\n\t\r\n&lt;\/head&gt;\r\n&lt;body onload=\"instantiateMyDatePicker()\"&gt;\r\n\t&lt;input type=\"text\" id=\"myDatePickerId\" \/&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>In both cases, we result with an input which displays a datepicker when it receives focus.<\/p>\n<figure id=\"attachment_16606\" aria-describedby=\"caption-attachment-16606\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMinstantiation.png\"><img decoding=\"async\" class=\"wp-image-16606 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMinstantiation.png\" alt=\"\" width=\"860\" height=\"410\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMinstantiation.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMinstantiation-300x143.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMinstantiation-768x366.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-16606\" class=\"wp-caption-text\"><br \/> Fig. 1: Instantiation<\/figcaption><\/figure>\n<h2>3. Different kinds of markups<\/h2>\n<p>You can instantiate a datepicker on just about any HTML tag, and it will be displayed when that tag receives focus. Obviously however, there are tags that are logically better suited for instantiating datepickers:<\/p>\n<ul>\n<li>Text inputs: pick a date and have it show in the input<\/li>\n<li>An empty div if you want to embed your datepicker into your page<\/li>\n<li>A div which contains different tags (such as, an input and an associated button) if you want several tags to be able to open the same datepicker.<\/li>\n<\/ul>\n<p>Let&#8217;s have a look at a few examples.<\/p>\n<h3>3.1. Input markup<\/h3>\n<p>Instantiate a datepicker on a text input. Probably the simplest and most obvious case.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Input markup<\/em><\/span><\/p>\n<pre class=\"brush:xml\">\t&lt;!-- Markup 1: \"input\". The input will show the picker when it receives focus. --&gt;\r\n\t&lt;input \r\n\t\ttype=\"text\"\r\n\t\tdata-provide=\"datepicker\" \r\n\t\/&gt;\r\n<\/pre>\n<h3>3.2. Component markup<\/h3>\n<p>If you have an input group (with class input-group) which contains an input and some addons (with class input-group-addon), you can allow the addons to open the datepicker as well as the input. Proceed as follows:<\/p>\n<ol>\n<li>Add class &#8220;date&#8221; to your input group<\/li>\n<li>Instantiate the datepicker on the input group.<\/li>\n<\/ol>\n<p><span style=\"text-decoration: underline;\"><em>Component markup<\/em><\/span><\/p>\n<pre class=\"brush:xml\">\t&lt;!-- Markup 2: \"component\". On your datepicker, set class \"input-group\", then add the \"date\" class to it, and you can then show the datepicker when components with class \"input-group-addon\" receive focus. --&gt;\r\n\t&lt;div class=\"input-group date\" data-provide=\"datepicker\"&gt;\r\n\t\t&lt;input type=\"text\" class=\"form-control\"&gt;\t\t\r\n\t\t&lt;span class=\"glyphicon glyphicon-calendar input-group-addon\"&gt;&lt;\/span&gt;\r\n\t&lt;\/div&gt;\r\n<\/pre>\n<figure id=\"attachment_16602\" aria-describedby=\"caption-attachment-16602\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMComponent-markup.png\"><img decoding=\"async\" class=\"wp-image-16602 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMComponent-markup.png\" alt=\"\" width=\"860\" height=\"410\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMComponent-markup.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMComponent-markup-300x143.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMComponent-markup-768x366.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-16602\" class=\"wp-caption-text\"><br \/> Fig. 2: Component markup<\/figcaption><\/figure>\n<p>If you&#8217;re not familiar with input groups, you can read up about them on Web Code Geek&#8217;s introduction to Bootstrap: <a>https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-tutorial\/#input-groups<\/a><\/p>\n<h3>3.3. Date range markup<\/h3>\n<p>In an input group, you can add several inputs which open datepickers which are linked. This allows you to select date ranges.<\/p>\n<ol>\n<li>Add class &#8220;input-daterange&#8221; to your input group, and instantiate the datepicker on it<\/li>\n<li>Add several inputs to your input group.<\/li>\n<\/ol>\n<p><span style=\"text-decoration: underline;\"><em>Date range markup<\/em><\/span><\/p>\n<pre class=\"brush:xml\">\t&lt;!-- Markup 3: \"date-range\". On your datepicker, set class \"input-group\" then \"input-daterange\", then each input will instantiate a picker when it receives focus. These pickers will be linked together, so you can select ranges. --&gt;\r\n\t&lt;div class=\"input-group input-daterange\" data-provide=\"datepicker\"&gt;\r\n\t\t&lt;input type=\"text\" \/&gt;\r\n\t\t&lt;span class=\"input-group-addon\"&gt;to&lt;\/span&gt;\r\n\t\t&lt;input type=\"text\" \/&gt;\r\n\t&lt;\/div&gt;\r\n<\/pre>\n<figure id=\"attachment_16603\" aria-describedby=\"caption-attachment-16603\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDate-range-markup.png\"><img decoding=\"async\" class=\"wp-image-16603 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDate-range-markup.png\" alt=\"\" width=\"860\" height=\"410\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDate-range-markup.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDate-range-markup-300x143.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDate-range-markup-768x366.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-16603\" class=\"wp-caption-text\"><br \/> Fig. 3: Date range markup<\/figcaption><\/figure>\n<h2>4. Options<\/h2>\n<h3>4.1. Most used options<\/h3>\n<p>I won&#8217;t be providing all the options; that&#8217;s the job of the documentation. Instead, I&#8217;ll just focus on the most frequently used ones. If you&#8217;re interested in seeing all available options, refer to the documentation: <a>https:\/\/bootstrap-datepicker.readthedocs.io<\/a><br \/>\nYou can use these options in JavaScript or with data attributes:<\/p>\n<ul>\n<li>Using JavaScript: pass the options in an object when you instantiate the datepicker:\n<pre class=\"brush:xml\">$('.datepicker').datepicker({\r\n    format: 'mm\/dd\/yyyy',\r\n    startDate: '-3d'\r\n});\r\n<\/pre>\n<\/li>\n<li>Using data attributes: for each option name, replace each uppercase letter with its lowercase version preceded by a dash, then prepend the whole with &#8220;data-date&#8221;. This is the attribute you need to assign to your HTML component. For example:\n<pre class=\"brush:xml\">\t\t\t&lt;input data-date-format=\"dd MM yyyy\" \/&gt;\r\n<\/pre>\n<\/li>\n<\/ul>\n<p>Now that we know how to implement these options, let&#8217;s explore the most commonly used ones.<\/p>\n<ul>\n<li><b>autoclose<\/b>: if true, the datepicker will close as soon as a date is selected. By default: false.<\/li>\n<li><b>clearBtn<\/b>: if true, a &#8220;Clear&#8221; button will be displayed at the bottom of the datepicker. By default: false.<\/li>\n<li><b>startDate<\/b> and <b>endDate<\/b>: specifies the start and end date of the calendar. By default, respectively beginning of time (January 1st of year 0, I presume) and end of time (uh&#8230; you just keep going forever). These can be either hardcoded dates, or relative to the current date (-9d: nine days ago, +8w: in eight weeks, etc).<\/li>\n<li><b>format<\/b>: date format. Default: mm\/dd\/yyyy.<\/li>\n<li><b>language<\/b>: language of the datepicker. For this to work, you need to include the Bootstrap datepicker JavaScript library in the locale of your choice. By default: english.<\/li>\n<li><b>todayBtn<\/b>: if true, displays a &#8220;Today&#8221; button at the bottom of the datepicker, which selects the current date. By default: false.<\/li>\n<\/ul>\n<p>See below for an example.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Options.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Datepicker options&lt;\/title&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n\t&lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n\t&lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n\t\r\n\t&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/js\/bootstrap-datepicker.js\"&gt;&lt;\/script&gt;\r\n\t&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/locales\/bootstrap-datepicker.fr.min.js\"&gt;&lt;\/script&gt;\r\n\t\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/css\/bootstrap-datepicker.css\"&gt;&lt;\/link&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;input \r\n\t\ttype=\"text\"\r\n\t\tdata-date-autoclose=\"true\"\r\n\t\tdata-date-clear-btn=\"true\"\r\n\t\tdata-date-format=\"dd MM yyyy\"\r\n\t\tdata-date-language=\"fr\"\r\n\t\tdata-date-today-highlight=\"true\"\r\n\t\tdata-date-end-date=\"+2m\"\r\n\t\tdata-date-start-date=\"-3d\"\r\n\t\tdata-provide=\"datepicker\" \/&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<figure id=\"attachment_16608\" aria-describedby=\"caption-attachment-16608\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMOptions.png\"><img decoding=\"async\" class=\"wp-image-16608 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMOptions.png\" alt=\"\" width=\"860\" height=\"410\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMOptions.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMOptions-300x143.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMOptions-768x366.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-16608\" class=\"wp-caption-text\"><br \/> Fig. 4: Options<\/figcaption><\/figure>\n<h3>4.2. Overriding default options<\/h3>\n<p>You can override the default options at any times by changing the value of $.fn.datepicker.defaults. This is an object which represents the default options for your datepickers, and contains a key for every possible option, with an associated value. As such, you can override a default option at any time by using the following syntax: <i>$.fn.datepicker.defaults.optionName = optionNewDefaultValue;<\/i>. See the example below.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Override default format option<\/em><\/span><\/p>\n<pre class=\"brush:xml\">\t&lt;script&gt;\r\n\t\t$.fn.datepicker.defaults.format = \"dd\/mm\/yyyy\"; \r\n\t&lt;\/script&gt;\r\n<\/pre>\n<p>Here is what the $.fn.datepicker.defaults objects contains (inspected with Firefox Developer Edition).<\/p>\n<figure id=\"attachment_16604\" aria-describedby=\"caption-attachment-16604\" style=\"width: 346px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDefaults.png\"><img decoding=\"async\" class=\"wp-image-16604 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDefaults.png\" alt=\"\" width=\"346\" height=\"419\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDefaults.png 346w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMDefaults-248x300.png 248w\" sizes=\"(max-width: 346px) 100vw, 346px\" \/><\/a><figcaption id=\"caption-attachment-16604\" class=\"wp-caption-text\">Fig. 5: Inspecting the default object.<\/figcaption><\/figure>\n<h2>5. Methods<\/h2>\n<p>The datepicker exposes methods which you can call in JavaScript. Here are some of the ones you&#8217;re most likely to use.<\/p>\n<ul>\n<li><b>show<\/b>: shows the picker. <b>hide<\/b>: hides the picker.<\/li>\n<li><b>setDate<\/b>: set a date on the picker. <b>getDate<\/b>: retrieve the picker&#8217;s date.<\/li>\n<li><b>clearDates<\/b>: clear the picker&#8217;s dates.<\/li>\n<\/ul>\n<p>The syntax for calling the methods is quite particular. You&#8217;ve got to pass them as arguments to the datepicker method, on your datepicker. Something like this: <b><i>$(&#8216;.datepicker&#8217;).datepicker(&#8216;setDate&#8217;, &#8217;04\/08\/1994&#8242;);<\/i><\/b>.<br \/>\nSee the examples below.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Methods.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Datepicker methods&lt;\/title&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n\t&lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n\t&lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n\t\r\n\t&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/js\/bootstrap-datepicker.js\"&gt;&lt;\/script&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/css\/bootstrap-datepicker.css\"&gt;&lt;\/link&gt;\r\n\t\r\n\t&lt;script&gt;\r\n\t\tfunction hideTheDatePicker() {\r\n\t\t\t$('.datepicker').datepicker('hide');\r\n\t\t}\r\n\t\t\r\n\t\tfunction showTheDatePicker() {\r\n\t\t\t$('.datepicker').datepicker('show');\r\n\t\t}\r\n\t\t\r\n\t\tfunction setDateOnDatePicker() {\r\n\t\t\t$('.datepicker').datepicker('setDate', '04\/08\/1994');\r\n\t\t}\r\n\t\t\r\n\t\tfunction getAndDisplayDateOnDatePicker() {\r\n\t\t\tvar sDateAsString = $('.datepicker').datepicker('getDate');\r\n\t\t\talert(sDateAsString);\r\n\t\t}\r\n\t\t\r\n\t\tfunction clearDatesOnDatePicker() {\r\n\t\t\t$('.datepicker').datepicker('clearDates');\r\n\t\t}\r\n\t&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;input \r\n\t\tid=\"myDatePickerId\"\r\n\t\ttype=\"text\"\r\n\t\tclass=\"datepicker\"\r\n\t\tdata-provide=\"datepicker\" \/&gt;\r\n\t\t\r\n\t&lt;input\r\n\t\ttype=\"button\"\r\n\t\tvalue=\"Hide the picker\"\r\n\t\tonclick=\"hideTheDatePicker()\" \/&gt;\r\n\t&lt;input\r\n\t\ttype=\"button\"\r\n\t\tvalue=\"Show the picker\"\r\n\t\tonclick=\"showTheDatePicker()\" \/&gt;\r\n\t&lt;input\r\n\t\ttype=\"button\"\r\n\t\tvalue=\"Update the picker\"\r\n\t\tonclick=\"updateTheDatePicker()\" \/&gt;\r\n\t&lt;input\r\n\t\ttype=\"button\"\r\n\t\tvalue=\"Set a date on the picker\"\r\n\t\tonclick=\"setDateOnDatePicker()\" \/&gt;\r\n\t&lt;input\r\n\t\ttype=\"button\"\r\n\t\tvalue=\"Get the picker date\"\r\n\t\tonclick=\"getAndDisplayDateOnDatePicker()\" \/&gt;\r\n\t&lt;input\r\n\t\ttype=\"button\"\r\n\t\tvalue=\"Clear the picker\"\r\n\t\tonclick=\"clearDatesOnDatePicker()\" \/&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<figure id=\"attachment_16607\" aria-describedby=\"caption-attachment-16607\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMMethods.png\"><img decoding=\"async\" class=\"wp-image-16607 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMMethods.png\" alt=\"\" width=\"860\" height=\"410\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMMethods.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMMethods-300x143.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMMethods-768x366.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-16607\" class=\"wp-caption-text\">Fig. 6: Methods.<\/figcaption><\/figure>\n<h2>6. Events<\/h2>\n<p>The datepicker fires different events when actions occur. Here are some of the main ones.<\/p>\n<ul>\n<li><b>show<\/b> and <b>hide<\/b>: fired when the datepicker is respectively shown and hidden.<\/li>\n<li><b>clearDate<\/b>: fired when the clear date button is pressed.<\/li>\n<li><b>changeDate<\/b>: fired when the date is changed.<\/li>\n<li><b>changeMonth, changeYear, changeDecade, changeCentury<\/b>: I really hope the names are intuitive enough.<\/li>\n<\/ul>\n<p>Again, let&#8217;s see a little example below.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Events.html<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Datepicker events&lt;\/title&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;&lt;\/link&gt; \r\n\t&lt;script src=\"http:\/\/code.jquery.com\/jquery-3.1.1.min.js\"&gt;&lt;\/script&gt;\r\n\t&lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\r\n\t\r\n\t&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/js\/bootstrap-datepicker.js\"&gt;&lt;\/script&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap-datepicker\/1.6.4\/css\/bootstrap-datepicker.css\"&gt;&lt;\/link&gt;\r\n\t\r\n\t&lt;script&gt;\r\n\t\tfunction initDatepicker() {\r\n\t\t\t$('#myDatePickerId').datepicker()\r\n\t\t\t\t.on('show', function() {\r\n\t\t\t\t\tconsole.log('show');\r\n\t\t\t\t})\r\n\t\t\t\t.on('hide', onHide)\r\n\t\t\t\t.on('clearDate', onClearDate)\r\n\t\t\t\t.on('changeDate', onChangeDate)\r\n\t\t\t\t.on('changeMonth', onChangeMonth);\r\n\t\t}\r\n\t\t\r\n\t\tfunction onHide() {\r\n\t\t\tconsole.log('on hide');\r\n\t\t}\r\n\t\t\r\n\t\tfunction onClearDate() {\r\n\t\t\tconsole.log('on clear date');\r\n\t\t}\r\n\t\t\r\n\t\tfunction onChangeDate(dateParam) {\r\n\t\t\tconsole.log('Date changed! New date: ' + dateParam.date);\r\n\t\t}\r\n\t\t\r\n\t\tfunction onChangeMonth() {\r\n\t\t\tconsole.log('Month changed');\r\n\t\t}\r\n\t\t\r\n\t&lt;\/script&gt;\r\n\t\t\r\n&lt;\/head&gt;\r\n&lt;body onload=\"initDatepicker();\"&gt;\r\n\t&lt;input type=\"text\" id=\"myDatePickerId\"\r\n\t\tdata-date-clear-btn=\"true\" \/&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<figure id=\"attachment_16605\" aria-describedby=\"caption-attachment-16605\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMevents.png\"><img decoding=\"async\" class=\"wp-image-16605 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMevents.png\" alt=\"\" width=\"860\" height=\"401\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMevents.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMevents-300x140.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/WMevents-768x358.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-16605\" class=\"wp-caption-text\">Fig. 7: Overriding the default value for the format option.<\/figcaption><\/figure>\n<h2>7. Summary<\/h2>\n<p>We&#8217;ve learnt how to get started on Bootstrap&#8217;s datepicker widget, and explored the different options, events and methods available. For more, have a look at the documentation: <a href=\"https:\/\/bootstrap-datepicker.readthedocs.io\/en\/latest\/\">https:\/\/bootstrap-datepicker.readthedocs.io\/en\/latest\/<\/a>.<\/p>\n<h2>8. Download the source code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <strong><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/03\/Bootstrap-datepicker.zip\">Bootstrap datepicker<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;s article, we will be looking into how to get started quickly with Bootstrap&#8217;s datepicker, and explore a few of the different options, methods and events that are available. To follow this example, all you need is a text editor; I will be using Notepad++. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ulp &hellip;<\/p>\n","protected":false},"author":216,"featured_media":8515,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[284],"tags":[],"class_list":["post-16506","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bootstrap"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Bootstrap Datepicker Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In today&#039;s article, we will be looking into how to get started quickly with Bootstrap&#039;s datepicker, and explore a few of the different options, methods\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bootstrap Datepicker Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In today&#039;s article, we will be looking into how to get started quickly with Bootstrap&#039;s datepicker, and explore a few of the different options, methods\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-13T14:15:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-08T11:13:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christopher Leneve\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Leneve\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/\"},\"author\":{\"name\":\"Christopher Leneve\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/a2bd8cabd55ea6b147dc8fb2e5e606f7\"},\"headline\":\"Bootstrap Datepicker Example\",\"datePublished\":\"2017-03-13T14:15:13+00:00\",\"dateModified\":\"2018-01-08T11:13:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/\"},\"wordCount\":1418,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"articleSection\":[\"Bootstrap\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/\",\"name\":\"Bootstrap Datepicker Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"datePublished\":\"2017-03-13T14:15:13+00:00\",\"dateModified\":\"2018-01-08T11:13:14+00:00\",\"description\":\"In today's article, we will be looking into how to get started quickly with Bootstrap's datepicker, and explore a few of the different options, methods\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/css\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Bootstrap\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/css\/bootstrap\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Bootstrap Datepicker Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/a2bd8cabd55ea6b147dc8fb2e5e606f7\",\"name\":\"Christopher Leneve\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/48dcf3df34e69343d3e26d69aef515cedc3b750abba2e0f1d7f755df14030431?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/48dcf3df34e69343d3e26d69aef515cedc3b750abba2e0f1d7f755df14030431?s=96&d=mm&r=g\",\"caption\":\"Christopher Leneve\"},\"description\":\"Chris is a developer with over four years of experience. He has come to specialize in web development over the years. Chris is very interested in IT in general, as well as robotics.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/christopher-leneve\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bootstrap Datepicker Example - Web Code Geeks - 2026","description":"In today's article, we will be looking into how to get started quickly with Bootstrap's datepicker, and explore a few of the different options, methods","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/","og_locale":"en_US","og_type":"article","og_title":"Bootstrap Datepicker Example - Web Code Geeks - 2026","og_description":"In today's article, we will be looking into how to get started quickly with Bootstrap's datepicker, and explore a few of the different options, methods","og_url":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-03-13T14:15:13+00:00","article_modified_time":"2018-01-08T11:13:14+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","type":"image\/jpeg"}],"author":"Christopher Leneve","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Christopher Leneve","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/"},"author":{"name":"Christopher Leneve","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/a2bd8cabd55ea6b147dc8fb2e5e606f7"},"headline":"Bootstrap Datepicker Example","datePublished":"2017-03-13T14:15:13+00:00","dateModified":"2018-01-08T11:13:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/"},"wordCount":1418,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","articleSection":["Bootstrap"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/","url":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/","name":"Bootstrap Datepicker Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","datePublished":"2017-03-13T14:15:13+00:00","dateModified":"2018-01-08T11:13:14+00:00","description":"In today's article, we will be looking into how to get started quickly with Bootstrap's datepicker, and explore a few of the different options, methods","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/11\/bootstrap-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/css\/bootstrap\/bootstrap-datepicker-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"CSS","item":"https:\/\/www.webcodegeeks.com\/category\/css\/"},{"@type":"ListItem","position":3,"name":"Bootstrap","item":"https:\/\/www.webcodegeeks.com\/category\/css\/bootstrap\/"},{"@type":"ListItem","position":4,"name":"Bootstrap Datepicker Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/a2bd8cabd55ea6b147dc8fb2e5e606f7","name":"Christopher Leneve","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/48dcf3df34e69343d3e26d69aef515cedc3b750abba2e0f1d7f755df14030431?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/48dcf3df34e69343d3e26d69aef515cedc3b750abba2e0f1d7f755df14030431?s=96&d=mm&r=g","caption":"Christopher Leneve"},"description":"Chris is a developer with over four years of experience. He has come to specialize in web development over the years. Chris is very interested in IT in general, as well as robotics.","sameAs":["https:\/\/www.webcodegeeks.com"],"url":"https:\/\/www.webcodegeeks.com\/author\/christopher-leneve\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/216"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=16506"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16506\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/8515"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=16506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=16506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=16506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}