More about twitter bootstrap datepicker

I have blogged about the bootstrap datepicker earlier. Here is the link

https://kevww.wordpress.com/2012/03/20/bootstrap-from-twitter-is-missing-a-date-picker/

I personally find that is pretty annoy after you select the date, the calendar popup doesn’t disappear.

So I put some extra code in the on change event, to hide it.

$('#SelectedDate').datepicker({ format: "dd/mm/yyyy" }).on('changeDate', function (ev) {
             $(this).blur();
             $(this).datepicker('hide');
         });

If you don’t set blur(), the textbox will not lose focus and if you click the textbox again, the calendar popup will show.

And then hide the datepicker.

So what I have done here, is lose the focus and hide it.

Advertisements

2 thoughts on “More about twitter bootstrap datepicker

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