Forum Discussion

lucas's avatar
lucas
Creator II
5 years ago
Solved

how to retrieve checkbox value from form ?

hello, i have a form that needs to get user inputs. On this form there are text fields, check boxes and a validate button that runs the logic to retrive the inputs. I'm able to retrieve the text fi...
  • Gopikrishnan's avatar
    5 years ago

    Hi Lucas,

    Can you try below code (replace bold letters with checkbox name)

    var tolerance = document.querySelector('input[name="tolerance"]').checked;

    alert(tolerance);

    You will get true if it is checked, else false in alert

    Thank You

    Gopikrishnan R