I have a modal with some information in it and with a button click I want to replace this information with an expanded calendar in order for the user to select a date. So to be more particular the first text is GDPR agreement where the user must click I agree and then the modal body must be replaced with an opened calendar where the user must select his date of birth. Then if user is > 18 years old the login screen appears. But I cannot display the opened calendar. Here is my code:
MODAL
<div class="modal fade" id="smallModal" tabindex="-1" role="dialog" aria-labelledby="smallModalLabel"
aria-hidden="true" style="width:100%;">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="smallBody">
<div id="gdprtext">
<h4 style="color:#1A1055; text-align: center;">GDPR Text</h4>
texttexttext ....
</div>
<input id="#datepicker" type="date" >
</div>
<div class="my-modal-footer" >
<div style="display: flex; justify-content: flex-start; margin-left:10px;">
<label for="gdprchk" >
<input type="checkbox" id="gdprchk" required style="margin-right:10px;">Δέχομαι
</label>
</div>
<div style="display: flex; justify-content: center;">
<button type="button" id="acceptbtn" style="background-color: #1A1055; color:white; margin-bottom: 10px;">ΑΠΟΔΟΧΗ</button>
</div>
</div>
</div>
</div>
</div>
Javascript
<script>
// display a modal (small modal)
$( document ).ready(function(event) {
$('#smallModal').modal("show");
$('#datepicker').css("display", "none");
$('#acceptbtn').prop("disabled", true);
$('#gdprchk').on('change', function(e) {
e.stopImmediatePropagation();
if(this.checked){
$('#acceptbtn').prop("disabled", false);
$('#gdpr').val(true);
}
else{
$('#acceptbtn').prop("disabled", true);
$('#gdpr').val(false);
}
});
$('#acceptbtn').on('click', function() {
$('#gdprtext').hide();
$("#datepicker").css("display", "block");
$('.my-modal-footer').hide();
});
});
</script>
Scripts and css
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<!-- Script -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js' type='text/javascript'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>
UPDATE After fix provided by Swati in comments I managed to display the field but I want to show the calendar expanded. How I can achieve that?