EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

required attribute | required property

When present, marks an element that can't be submitted without a value.

This property is read/write.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.10.7.3.6Internet Explorer 10

 

Syntax

HTML
<element required="ptr" ... >

 

JavaScript
object.required = ptr
ptr = object.required

 

Property values

Type: boolean

A boolean attribute that designates an input field as requiring data.

Standards information

Remarks

The attribute can be set on text, text area, URL, email, select, checkbox, or radio button elements. It is a Boolean attribute and needs to be specified only on an element. When users hover the mouse over a required field, they’ll see a tool tip stating that it is a required field.

The following example shows the validation attribute on a text input field.


<p><label>Name: <input type="text" required /></label></p>


See also

HTMLInputElement
HTMLSelectElement
HTMLTextAreaElement

 

 

표시:
© 2014 Microsoft