Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Setting Length Constraints | HTML5 Built-in Validation
JavaScript Form Validation

bookSetting Length Constraints

When you want to control how many characters a user can enter in a text field, you can use the HTML5 minlength and maxlength attributes. These attributes allow you to set the minimum and maximum number of characters that are accepted for an input. This is especially useful for fields like usernames, passwords, or comments, where you want to prevent entries that are too short or too long.

index.html

index.html

copy

When you use minlength and maxlength on an input, browsers automatically check the length of the user's entry when the form is submitted. If the input is shorter than the minlength or longer than the maxlength, the browser will prevent the form from being submitted and will usually show a built-in error message. This makes it easy to enforce basic length rules without writing any JavaScript.

question mark

Which attribute enforces a minimum length on a password field?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 3

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Awesome!

Completion rate improved to 5.56

bookSetting Length Constraints

Свайпніть щоб показати меню

When you want to control how many characters a user can enter in a text field, you can use the HTML5 minlength and maxlength attributes. These attributes allow you to set the minimum and maximum number of characters that are accepted for an input. This is especially useful for fields like usernames, passwords, or comments, where you want to prevent entries that are too short or too long.

index.html

index.html

copy

When you use minlength and maxlength on an input, browsers automatically check the length of the user's entry when the form is submitted. If the input is shorter than the minlength or longer than the maxlength, the browser will prevent the form from being submitted and will usually show a built-in error message. This makes it easy to enforce basic length rules without writing any JavaScript.

question mark

Which attribute enforces a minimum length on a password field?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 3
some-alt