Daniels Jirgensons Daniels Jirgensons - 1 year ago 85
Javascript Question

After select Bootrstrap datepicker date load to input field

I want to make, after select date on Bootstrap Datepicker, it's load a value on my input field, but I dont know how to do that. There's my JSFiddle.

This is my JQuery for datepicker

$(function () {
$('.datetimepickerinline').datetimepicker({inline: true});

I need to use it for all inputs, or in other words, closest input field.

Answer Source

Here is solution you want: jsfiddle

$('.datetimepickerinline').on('change dp.change', function(e){

See reference here

Further more, I noticed that you want use moment.js

You can use something like this, using custom format:

$('.datetimepickerinline').on('change dp.change', function(e){
   $('input').val(moment($(this).data('date')).format('DD/MM/YYYY, h:mm'));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download