38
Views
2
Comments
How to trap DatePicker Prev and Next Month Button
Application Type
Mobile

Hi,

I need help on the issue I am facing. The task that I am trying to do is when the Previous and Next Button of the DatePicker is clicked, I would like to get the month and do something with it. I added the addEventListener javascript to the element in OnReady, but I am still having issue with as the element return undefine. The code that I did to add the event listener is below:

var elPrevMth = document.getElementsByClassName('pika-prev')[0];
elPrevMth.addEventListener('click', function(){console.log('hello world');});


I tested to console log the element that I want to add the click event on the screenshoot and true enough if I read the HTMLcollection list, it returns undefine.


Appreciate any help.


Regards,

Yudi



Screenshot20210928120258.jpg
UserImage.jpg
Ellakkiya

Hello Yudi Gemi Sutanto Tjong,

Kindly refer the attached link

Hope this helps!

Regards,

Ellakkiya.S

UserImage.jpg
Yudi Gemi Sutanto Tjong

Hi, I have read this link before. The problem I encountered with it is that:
1. jQuery is not advisable on Mobile.
2. I thought my DOM solution is similar with his. But I could not make it work 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.