How does JS get the value of input?

var inputEl = document.querySelector('[name=”username”]'); var val = inputEl. value; console.log(val); input attribute HTML5 property value description accept mime_type Specifies the type of file to submit via file upload. align left right top middle bottom Deprecated. Specifies the alignment of the image input. alt text Define the image input Alt text. autocomplete on off Specifies whether to use the autocomplete function of the input field. autofocus autofocus Determines whether the input field gets focus when the page loads. (not applicable to type=”hidden”) checked checked Specifies that this input element should be selected when it is first loaded. disabled disabled When the input element is loaded disable this element. form formname Specifies one or more forms to which the input field belongs. formaction URL Overrides the form’s action attribute. (for type=”submit” and type=”image”) formenctype see note Overrides the form’s enctype attribute. (for type=”submit” and type=”image”) formmethod get post overrides the method attribute of the form. (for type=”submit” and type=”image”) formnovalidate formnovalidate Overrides the form’s novalidate attribute. If this attribute is used, no validation will be performed when the form is submitted. formtarget _blank _self _parent _top framename Overrides the form’s target attribute. (for type=”submit” and type=”image”) height pixels % Defines the height…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索