Calender Widget in JavaScript

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;
}
)

Hello there,

You have a couple of typos.

Your first c is actually a different unicode character there.

This isn’t the correct function call. Remember that JavaScript is case sensitive. :wink:

1 Like

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…

https://codepen.io/naimiii/pen/mdOrBmO

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?

Hi @naimiii !

I have merged your two topics together since they are about the same project.