aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/html/attributes/maxlength
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/html/attributes/maxlength
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/html/attributes/maxlength')
-rw-r--r--files/ja/web/html/attributes/maxlength/index.html59
1 files changed, 59 insertions, 0 deletions
diff --git a/files/ja/web/html/attributes/maxlength/index.html b/files/ja/web/html/attributes/maxlength/index.html
new file mode 100644
index 0000000000..002bfcb7ee
--- /dev/null
+++ b/files/ja/web/html/attributes/maxlength/index.html
@@ -0,0 +1,59 @@
+---
+title: 'HTML 属性: maxlength'
+slug: Web/HTML/Attributes/maxlength
+tags:
+ - Attribute
+ - Attributes
+ - Constraint validation
+translation_of: Web/HTML/Attributes/maxlength
+---
+<p>{{HTMLSidebar}}{{draft}}</p>
+
+<p><span class="seoSummary"><strong><code>maxlength</code></strong> 属性は、ユーザーが {{htmlelement('input')}} または {{htmlelement('textarea')}} に入力できる最大文字数を (UTF-16 コード単位で) 定義します。 0 以上の整数値である必要があります。</span> maxlength が指定されなかった場合、または無効な値が指定された場合は、 input や textarea には最大長が設定されません。</p>
+
+<p><code>maxlength</code> の値はすべて、 <code>minlength</code> が存在して有効である場合は、その値以上である必要があります。フィールドのテキスト値の長さが maxlength の UTF-16 コード単位の長さを超える場合、入力欄は制約検証に失敗します。制約検証は、ユーザーが値を変更した場合にのみ適用されます。</p>
+
+<h3 id="Constraint_validation" name="Constraint_validation">制約検証</h3>
+
+<p>ブラウザーは一般的に、 maxlength 属性が許可する以上のテキストをユーザーが入力することを防止しますが、長さが maxlength が許可しているよりも長くなった場合、 {{domxref("ValidityState")}} オブジェクトの読み取り専用の {{domxref("ValidityState.tooLong", "tooLong")}} プロパティが true になります。</p>
+
+<h2 id="Examples" name="Examples">例</h2>
+
+<pre class="brush: html notranslate">&lt;input type="password" maxlength="4"/&gt;
+</pre>
+
+<p>{{EmbedLiveSample('Examples', '100%', 200)}}</p>
+
+<h2 id="Specifications" name="Specifications">仕様書</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">仕様書</th>
+ <th scope="col">状態</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', 'input.html#attr-input-maxlength', 'maxlength attribute')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML5.1', 'input.html#attr-maxlength-accept', 'maxlength attribute')}}</td>
+ <td>{{Spec2('HTML5.1')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力したいのであれば、 <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>
+
+<p>{{Compat("html.elements.attribute.maxlength")}}</p>
+
+<h2 id="See_also" name="See_also">関連情報</h2>
+
+<ul>
+ <li><code><a href="/ja/docs/Web/HTML/Attributes/minlength">minlength</a></code></li>
+ <li><code><a href="/ja/docs/Web/HTML/Attributes/size">size</a></code></li>
+</ul>