object htmlinputelement что значит
Javascript, viewing [object HTMLInputElement]
How to get the data, that were added in text field, where my input type is text?
6 Answers 6
Chrome Developer Tools has a Properties tab which shows useful DOM attributes.
Also see MDN for a reference.
See an example in this jsFiddle.
Also, and seeing you’re starting to learn HTML, you might consider using console.log() instead of alert() for debugging purposes. It doesn’t interrupt the execution flow of the script, and you can have a general view of all logs in almost every browser with developer tools (except that one, obviously).
It’s not because you are using alert, it will happen when use document.write() too. This problem generally arises when you name your id or class of any tag as same as any variable which you are using in you javascript code. Try by changing either the javascript variable name or by changing your tag’s id/class name.
My code example: bank.html
Javascript code: bank.js
you can have a look and understand the concept from my code. Here i have used a variable named ‘amt’ in JS. You just try to run my code. It will work fine but as you put an [id=»amt»](without square brackets) (which is a variable name in JS code )for div tag in body of html you will see the same error that you are talking about. So simple solution is to change either the variable name or the id or class name.
Object htmlinputelement что значит
Note: Depending upon the environment in which the page is being viewed, the value property may be read-only for the file upload input type. For the «password» input type, the actual value returned may be masked to prevent unauthorized use. See the INPUT element definition in [HTML 4.01].
A comma-separated list of content types that a server processing this form will handle correctly.
Implementation
public function get accept():DOMString
public function set accept(value:DOMString):void
A single character access key to give access to the form control.
Implementation
public function get accessKey():DOMString
public function set accessKey(value:DOMString):void
Aligns this object (vertically or horizontally) with respect to its surrounding text.
Implementation
public function get align():DOMString
public function set align(value:DOMString):void
Alternate text for user agents not rendering the normal content of this element.
Implementation
public function get alt():DOMString
public function set alt(value:DOMString):void
When the type attribute of the element has the value «radio» or «checkbox», this represents the current state of the form control, in an interactive user agent. Changes to this attribute change the state of the form control, but do not change the value of the HTML checked attribute of the INPUT element.
Note: During the handling of a click event on an input element with a type attribute that has the value «radio» or «checkbox», some implementations may change the value of this property before the event is being dispatched in the document. If the default action of the event is canceled, the value of the property may be changed back to its original value. This means that the value of this property during the handling of click events is implementation dependent.
Implementation
public function get checked():Boolean
public function set checked(value:Boolean):void
When type has the value «radio» or «checkbox», this represents the HTML checked attribute of the element. The value of this attribute does not change if the state of the corresponding form control, in an interactive user agent, changes.
Implementation
public function get defaultChecked():Boolean
public function set defaultChecked(value:Boolean):void
When the type attribute of the element has the value «text», «file» or «password», this represents the HTML value attribute of the element. The value of this attribute does not change if the contents of the corresponding form control, in an interactive user agent, changes.
Implementation
public function get defaultValue():DOMString
public function set defaultValue(value:DOMString):void
The control is unavailable in this context.
Implementation
public function get disabled():Boolean
public function set disabled(value:Boolean):void
Returns the FORM element containing this control. Returns null if this control is not within the context of a form.
Implementation
public function get form():HTMLFormElement
Maximum number of characters for text fields, when type has the value «text» or «password».
Implementation
public function get maxLength():Number
public function set maxLength(value:Number):void
Form control or object name when submitted with a form
Implementation
public function get name():DOMString
public function set name(value:DOMString):void
The onblur event occurs when an element loses focus either by the pointing device or by tabbing navigation.
Implementation
public function get onblur():Function
public function set onblur(value:Function):void
The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus.
Implementation
public function get onchange():Function
public function set onchange(value:Function):void
The onfocus event occurs when an element receives focus either by the pointing device or by tabbing navigation.
Implementation
public function get onfocus():Function
public function set onfocus(value:Function):void
The onselect event occurs when a user selects some text in a text field.
Implementation
public function get onselect():Function
public function set onselect(value:Function):void
This control is read-only. Relevant only when type has the value «text» or «password».
Implementation
public function get readOnly():Boolean
public function set readOnly(value:Boolean):void
Size information. The precise meaning is specific to each type of field.
Implementation
public function get size():Number
public function set size(value:Number):void
When the type attribute has the value «image», this attribute specifies the location of the image to be used to decorate the graphical submit button.
Implementation
public function get src():DOMString
public function set src(value:DOMString):void
Index that represents the element’s position in the tabbing order.
Implementation
public function get tabIndex():Number
public function set tabIndex(value:Number):void
The type of control created (all lower case).
Implementation
public function get type():DOMString
public function set type(value:DOMString):void
Use client-side image map.
Implementation
public function get useMap():DOMString
public function set useMap(value:DOMString):void
When the type attribute of the element has the value «text», «file» or «password», this represents the current contents of the corresponding form control, in an interactive user agent. Changing this attribute changes the contents of the form control, but does not change the value of the HTML value attribute of the element. When the type attribute of the element has the value «button», «hidden», «submit», «reset», «image», «checkbox» or «radio», this represents the HTML value attribute of the element.
Implementation
public function get value():DOMString
public function set value(value:DOMString):void
Removes keyboard focus from this element.
Simulate a mouse-click. For INPUT elements whose type attribute has one of the following values: «button», «checkbox», «radio», «reset», or «submit».
Gives keyboard focus to this element.
Select the contents of the text area. For INPUT elements whose type attribute has one of the following values: «text», «file», or «password».
HTMLInputElement
Summary
Represents an input element within the DOM.
Properties
multiple Gets whether a file upload element can be populated with more than a single file.
validationMessage Returns the error message that would be displayed if the user submits the form, or an empty string if no error message.
Methods
Events
Inherited from HTMLElement
Properties
aria-describedby Sets or retrieves a list of elements that describe the current object.
draggable Gets or sets whether an element can be dragged and dropped.
ATOMICSELECTION html attribute Specifies whether the element and its contents must be selected as a whole, indivisible unit. BaseHref Retrieves a string of the URL where the object tag can be found, often the href of the document that the object is in, or the value set by a base element.
abbr Indicates an abbreviation or an acronym. accept This attribute supplies browsers with a hint about what filetypes its element will accept. accessKey Sets a keyboard keystroke for selection of its element, which would otherwise be done using a mouse.
allowTransparency Sets or retrieves whether the object can be transparent. alt The alt attribute is used as a textual representation for graphics and buttons in browsers that don’t or can’t render images, or when the resource is not found. autocomplete The autocomplete attribute specifies whether a browser should automatically provide values for a form element. autofocus Provides a way to direct a user to a specific field when a document loads.
class Specifies one or more classes for an element, usually used to point to a class in a style sheet. classid Sets or retrieves the class identifier for the object.
codeBase Sets or retrieves the URL of the component.
color The foreground color of the text of an object.
cols (frameSet) Sets or retrieves the number of columns in the table.
contentEditable Sets or retrieves the string that indicates whether the user can edit the content of the object.
dataFld Sets or retrieves a field of a given data source, as specified by the dataSrc property, to bind to the specified object.
dataSrc Sets or retrieves the source of the data for data binding. dir Global attribute. Specifies the element’s text directionality. disabled Prevents users from changing, clicking on, or submitting an element. face Sets or retrieves the current typeface family. formAction The formaction attribute specifies the URL of a file that will process the input control when the form is submitted. formEnctype The formenctype attribute specifies how the form-data should be encoded when submitting it to the server. formMethod The formmethod attribute defines the HTTP method for sending form-data to the action URL. formNoValidate When present, it specifies that the element should not be validated when submitted. formtarget Specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
height Specifies the height of the certain content elements in pixels. hidden The hidden attribute is a boolean attribute. When specified on an element, it indicates that the element is not yet, or is no longer, directly relevant to the page’s current state, or that it is being used to declare content to be reused by other parts of the page as opposed to being directly accessed by the user.
href Sets or retrieves a destination URL or an anchor point
id The id attribute is used for identifying elements in a document. is Describes the base element from which the element with this attribute is extended.
list The list attribute refers to a element specifying possible values to suggest for an input element. longdesc Links an image to a description of its content, for enhanced accessibility loop Sets or retrieves the number of times a sound or video clip will loop when activated. max (HTMLInputElement) The max attribute specifies the maximum value for an element. maxLength The maxLength attribute sets an upper limit on the number of characters that can be entered in an input element. min The min attribute specifies the minimum value for an element. multiple The multiple attribute indicates that the user is allowed to enter more than one value in an element.
noValidate When present, it specifies that the form-data (input) should not be validated when submitted.
pattern The pattern attribute specifies a regular expression that the element’s value is checked against. placeholder The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a sample value or a short description of the expected format).
rel Describes the relationship from the current document to the anchor specified by the href attribute. required The required attribute is a boolean attribute. When present, it specifies that an input field must be filled out before submitting the form.
size This article outlines the HTML attribute «size», which allows the user to specify a width in characters of an element.
standby A message for the browser to show while an object ‘s implementation and data load.
tabIndex Represents the tab order of an element.
target Target is a link attribute, which defines where to open the link.
type The type attribute is used to define what sort of type an input or ordered list element is.
width Specifies the width, in pixels, of certain content elements.
wrap Sets the wrap style (soft, hard, or off) for a text element. alignment-baseline Specifies how an element is aligned with respect to its parent; that is, specifies which baseline of the element is to be aligned with the corresponding baseline of the parent. Defaults to the baseline with the same name as the computed value of the alignment-baseline property. baseline-shift The ‘baseline-shift’ property allows repositioning of the dominant-baseline( a baseline-table and a baseline-table font-size which are those of the nearest block-level ancestor element and are applied to its root inline box.) relative to the dominant-baseline.
fill The attribute fill specifies the filling color or the behavior of an animation after it has finished. fill-opacity Please refer to /css/properties/fill-opacity fill-rule Please refer to /css/properties/fill-rule
Methods
click Covers what the click action is and what happens when it is performed.
getBoundingClientRect Returns a ClientRect object that encloses a group of text rectangles. getClientRects A collection of ClientRect objects, one for each CSS border box associated with the element. Each ClientRect object contains read-only left, top, right, and bottom properties describing the border box, relative to the top-left of the viewport. For tables with captions, the caption is included even though it is outside the border box of the table.
Web/API/HTMLInputElement
The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of elements.
Properties
form Read only | HTMLFormElement object: Returns a reference to the parent element. |
formAction | string : Returns / Sets the element’s formaction attribute, containing the URI of a program that processes information submitted by the element. This overrides the action attribute of the parent form. |
formEnctype | string : Returns / Sets the element’s formenctype attribute, containing the type of content that is used to submit the form to the server. This overrides the enctype attribute of the parent form. |
formMethod | string : Returns / Sets the element’s formmethod attribute, containing the HTTP method that the browser uses to submit the form. This overrides the method attribute of the parent form. |
formNoValidate | Boolean : Returns / Sets the element’s formnovalidate attribute, indicating that the form is not to be validated when it is submitted. This overrides the novalidate attribute of the parent form. |
formTarget | string : Returns / Sets the element’s formtarget attribute, containing a name or keyword indicating where to display the response that is received after submitting the form. This overrides the target attribute of the parent form. |
name | string : Returns / Sets the element’s name attribute, containing a name that identifies the element when submitting the form. | ||||||||||||||||||||
type | string : Returns / Sets the element’s type attribute, indicating the type of control to display. See type attribute of for possible values. | ||||||||||||||||||||
disabled | Boolean : Returns / Sets the element’s disabled attribute, indicating that the control is not available for interaction. The input values will not be submitted with the form. See also readonly | ||||||||||||||||||||
autofocus | Boolean : Returns / Sets the element’s autofocus attribute, which specifies that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form element in a document can have the autofocus attribute. It cannot be applied if the type attribute is set to hidden (that is, you cannot automatically set focus to a hidden control). | ||||||||||||||||||||
required | Boolean : Returns / Sets the element’s required attribute, indicating that the user must fill in a value before submitting a form. | ||||||||||||||||||||
value | string : Returns / Sets the current value of the control. Note: If the user enters a value different from the value expected, this may return an empty string. on : the browser can autocomplete the value using previously stored value off : the user must explicity enter a value | ||||||||||||||||||||
selectionStart | unsigned long : Returns / Sets the beginning index of the selected text. When nothing is selected, this returns the position of the text input cursor (caret) inside of the element. | ||||||||||||||||||||
selectionEnd | unsigned long : Returns / Sets the end index of the selected text. When there’s no selection, this returns the offset of the character immediately following the current text input cursor position. | ||||||||||||||||||||
selectionDirection | string : Returns / Sets the direction in which selection occurred. Possible values are: forward if selection was performed in the start-to-end direction of the current locale backward for the opposite direction none if the direction is unknown double : Returns the value of the element, interpreted as one of the following, in order: MethodsEventsListen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface: SpecificationsBrowser compatibilityThe compatibility table on this page is generated from structured data. If you’d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
|