HTMLFormElement.reportValidity()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since December 2018.
Метод HTMLFormElement.reportValidity()
возвращает true
если все дочерние элементы прошли проверку. Когда возвращается false
, по каждому дочернему элементу не прошедшему проверку генерируется событие invalid
и пользователю сообщаются проблемы проверки.
Синтаксис
HTMLFormElement.reportValidity()
Пример
document.forms["myform"].addEventListener('invalid', function() { //Опциональный ответ здесь. }, false); document.forms["myform"].addEventListener('submit', function() { document.forms["myform"].reportValidity(); }, false);
Спецификации
Совместимость с браузерами
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
reportValidity |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.