When the date is clicked, How to show a dialog with the Current date and welcome message in javaScript?
Here’s my code
let btnShow = document.querySelector('button');
let output = document.querySelector('h1');
btnShow.addEventListener('çlick', ()=>{
let today =new Date();
onclick="btnShow()"
let month=today.getMonth()+1;
let year=today.getFullYear();
let date=today.getdate();
let current_date= `${month}/${date}/${year}`;
output.innerText=current_date;
}
)
what will be the exact logic for the calender widget in JavaScript When a date is clicked show a dialogue with current date and welcome message? I have been trying this but didn’t get my desired output…
I don’t see anything in your code attempting to do what you say you want to do. Let’s start from the beginning. Do you know about event handlers and how to trigger an action by listing for the click event?