Listen to calendar field update in JS

Home Forums Quform WordPress Listen to calendar field update in JS

This topic is: resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34031
    Samurai
    Participant

    Hi,
    I’m trying with js to listen when a calendar input is updated, but so far I failed.
    By listening to the whole form change, I can get the updated value of the date field when another field is updated but not when the date field is updated.
    Here is my current code.

    let formDom = document.querySelector(‘.quform-4’);
    let dateDom = formDom.querySelector(‘.quform-field-4_4’);
    formDom.addEventListener(‘change’, ()=> {
    console.log(dateDom.value);
    })

    Any idea?
    Thanks

    #34037
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #34044
    Samurai
    Participant

    Thanks, It works! Now, I need to calculate the number of days between 2 dates. Any tips?

    #34049
    Samurai
    Participant

    You can close this thread, i did open a new one with my new question. Tx

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy