HTMLFormElement.length

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

io error: No such file or directory (os error 2) (/home/runner/work/yari/yari/mdn/translated-content/files/fr/web/api/html_dom_api/index.md)

La propriété en lecture seule HTMLFormElement.length retourne le nombre de contrôles présents dans l'élément <form>.

Syntaxe

js
integer = form.length;

Exemple

js
if (document.getElementById("form1").length > 1) {
  // more than one form control here
}

Spécifications