I need to get the value of Datetimepicker in my JavaScript function. I have made something like this, but it doesn't work:
$("#date").click( function(){
alert(document.getElementById('datetimepicker1').value);
});
It gives me 'undefined'
I need to get the value of Datetimepicker in my JavaScript function. I have made something like this, but it doesn't work:
$("#date").click( function(){
alert(document.getElementById('datetimepicker1').value);
});
It gives me 'undefined'
Try this (worked for me), when i had boostrap inline date time picker this is a way how i get selected datetime.
I tried all the above methods and I did not get the value properly in the same
format
, then I found this.The above code will return the value in the same format as in the datetime picker.
This may help you guys in the future.
Hope this was helpful..