Ukryty obiekt wejściowy HTML DOM
Wprowadź ukryty obiekt
Obiekt Input Hidden reprezentuje element HTML <input> z type="hidden".
Uzyskaj dostęp do ukrytego obiektu wejściowego
Możesz uzyskać dostęp do elementu <input> z type="hidden" za pomocą getElementById():
Przykład
var x = document.getElementById("myInput");
Wskazówka: możesz również uzyskać dostęp do <input type="hidden"> przeszukując kolekcję elementów formularza.
Utwórz ukryty obiekt wejściowy
Możesz utworzyć element <input> z type="hidden" za pomocą metody document.createElement():
Przykład
var x = document.createElement("INPUT");
x.setAttribute("type", "hidden");
Wprowadź właściwości obiektów ukrytych
Property | Description |
---|---|
defaultValue | Sets or returns the default value of the hidden input field |
form | Returns a reference to the form that contains the hidden input field |
name | Sets or returns the value of the name attribute of the hidden input field |
type | Returns which type of form element a hidden input field is |
value | Sets or returns the value of the value attribute of the hidden input field |
Standardowe właściwości i zdarzenia
Obiekt Input Hidden obsługuje również standardowe właściwości i zdarzenia .
Powiązane strony
Samouczek HTML: formularze HTML
Odniesienie HTML: tag HTML <input>
Odniesienie HTML: atrybut typu HTML <input>