跳到主要内容

💥 input

输入框 表单控件

场景用例

<!-- HTML 代码 -->

属性

属性(Attribute)说明(Description)值(Value)
alphaAllow the color's alpha component to be setBoolean attribute
formnovalidateBypass form control validation for form submissionBoolean attribute
requiredWhether the control is required for form submissionBoolean attribute
multipleWhether to allow multiple valuesBoolean attribute
checkedWhether the control is checkedBoolean attribute
disabledWhether the form control is disabledBoolean attribute
readonlyWhether to allow the value to be edited by the userBoolean attribute
acceptHint for expected file type in file upload controlsSet of comma-separated tokens* consisting of valid MIME type strings with no parameters or audio/, video/, or image/*
autocompleteHint for form autofill featureAutofill field name and related tokens*
listList of autocomplete optionsID*
colorspaceThe color space of the serialized color"limited-srgb"; "display-p3"
dirnameName of form control to use for sending the element's directionality in form submissionText*
form--
formaction--
formenctypeEntry list encoding type to use for form submission"application/x-www-form-urlencoded"; "multipart/form-data"; "text/plain"
formmethod--
formtarget--
src--
width--
height--
typeType of form controlinput type keyword
name--
valueValue of the form controlVaries*
maxMaximum valueVaries*
minMinimum valueVaries*
maxlengthMaximum length of valueValid non-negative integer
minlengthMinimum length of valueValid non-negative integer
sizeSize of the controlValid non-negative integer greater than zero
stepGranularity to be matched by the form control's valueValid floating-point number greater than zero, or "any"
patternPattern to be matched by the form control's valueRegular expression matching the JavaScript Pattern production
placeholderUser-visible label to be placed within the form controlText*
altReplacement text for use when images are not availableText*
popovertargetTargets a popover element to toggle, show, or hideID*
popovertargetactionIndicates whether a targeted popover element is to be toggled, shown, or hidden"toggle"; "show"; "hide"

事件

事件属性(Attribute)说明(Description)事件(Event)目标对象(target)接口(Interface)
oncancel-cancelinput elementsEvent
onchange-changeForm controlsEvent
onselect-selectForm controlsEvent
oninvalid-invalidForm controlsEvent
onbeforeinput-beforeinputinputInputEvent
oninput-inputinputInputEvent
onblur-blurinputFocusEvent
onfocus-focusinputFocusEvent
--focusininputFocusEvent
--focusoutinputFocusEvent

参考