<p>
<label for="password">Your password</label>
<input id="password" type="password" minlength="8" maxlength="20" />
</p>HTMLInputElement: minLength property / notebook
HTMLInputElement: minLength property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const inputElement = document.querySelector("#password");
console.log(`Element's minLength: ${inputElement.minLength}`); // "Element's minlength: 8"
inputElement.minLength = 12; // updates the element's minlength attribute value