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».
Web/API/HTMLInputElement
The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of elements.
Contents
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.
|