Hi I am trying inline bootstrap datepicker on div tag, whenever I click on div tag, datepicker popup is displaying on start of page(left=0, top=0)
Div click is on todays date, I want to get the date and change the todays date text.
<input type="hidden" id="datepicker"
data-provide='datepicker'
data-date-container='#todaysDate'>
<div id="todaysDate" class="trigger"
style="text-align: center; padding-top: 10px;
font-weight: bold; color: #f58125; font-size: 16px;">
and also I have tried with below code also
form class="form-date" role="form">
<div class="form-group" id="datepickid">
<div id="todaysDate" class="trigger"style="text-align: center;
padding-top: 10px; font-weight: bold; color: #f58125;
font-size: 16px;">
</div>
<input type="hidden" name="dt_due" id="datepicker">
</div>
</form>
Jquery code
$(".trigger").click(function(){
$( "#datepicker" ).datepicker({ format: 'dd-mm-yyyy',
startDate: '01/01/1900',
endDate: '12/30/2099',
ignoreReadonly: true
}).on('changeDate', function(ev){
$('#todaysDate').text(ev.format('dd-mm-yyyy'));
$("#datepicker").datepicker('hide');
});
$("#datepicker").datepicker("show");
});
both have the same problem.
whats wrong with code? Please anybody help me