I want to get the value of a date input field and alert it,but I always get an empty string or undefined. Any help on how to get the value of this field will be appreciated.
code -
var end = $('#datetimepicker2').val();
$('#sub').on('click', function () {
alert(end);
});
HTML CODE
<input type="text" class="form-control input-group-sm" placeholder="Enter Date" id="datetimepicker" aria-label="...">
I am using bootstrap-datepicker plugin to get the date. EDIT: I want to get the date in yyyy/mm/dd format and store it in a variable
var endline get executed?