I'm currently attempting to extract the date from a button and display it in another div. Initially, I tried using the input tag method but faced some issues. Therefore, I switched to employing the button option with an icon. My main challenge now is figuring out how to retrieve the date and present it elsewhere.
<button type="button" class="btn btn-icon btn-primary w-full" id="date" data-plugin="datepicker">
<i class="icon wb-calendar" aria-hidden="true">
</i></button>
<div id="show-date"></div>
Below is the JavaScript code:
$(function() {
var showdate = document.getElementById( 'show-date' );
$("#date").datepicker();
$("#date").on("change",function(){
var selected = $(this).val();
showdate.selected.show;
});
});