简体   繁体   中英

how to use input type date to input dates into a calendar

I was wondering how I would go about making a birthday calendar where I can insert dates (using JS, HTML and CSS). I already have a full calendar. I just dont know how to use input type date to insert a date into it. Thanks

You can attach an event listener to the input field and write an appropriate event handler that processes your date.

See the code below that logs the selected date on the console.

 $("#date").on('change', (event) => { const date = $(event.target).val(); // You can do whatever you want with this date console.log(date); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input type="date" id="date" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM