Bootstrap DatePicker events


Altoough JQuery UI provides datepicker. But I noticed that there are difference in working and methods of JQuery UI and bootstrap-datepicker.

So first check in your application.js file. If the line below is written there then its bootstrap-datepicker and you have to use its methods to bind extera events on your datepicker.

//= require bootstrap-datepicker

Guide for Bootstrap-datepicker

http://www.eyecon.ro/bootstrap-datepicker/

Guide for JQuery UI datepicker

http://jqueryui.com/datepicker/

Below is for Bootstrap-datepicker code to alert date which you get on selecting days and then datepicker will close.


$(function(){

  $('#datepicker').datepicker()
  .on('changeDate', function(ev) {
    alert(new Date(ev.date));
    $(this).datepicker('hide');
  });

});
Advertisements

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Tagged with: , , ,
Posted in JQuery
One comment on “Bootstrap DatePicker events

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

StackOverFlow
Categories
Archives
%d bloggers like this: