0

How is it possible to display (manually, without submit) the HTML element built in validation error message with Javascript?

Example:

    if(document.getElementById('id_checkbox').checked == false)
                    {
                       showBuiltInErrorMessage('id_checkbox'); --> "Please fill out this field"
                    }

Thanks for your help!

4
  • A form of course. Commented Aug 8, 2018 at 14:21
  • @Anamnian — Forms are the only things in HTML that are submitted. Commented Aug 8, 2018 at 14:21
  • My bad, didn't notice the tag. Commented Aug 8, 2018 at 14:22
  • Thanks! That's exactly what i was looking for! document.getElementById('id_element').reportValidity(); is the key Commented Aug 8, 2018 at 14:25

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.