Name

Hidden — hidden data for client/server communication

Availability

JavaScript 1.0; enhanced in JavaScript 1.1

Inherits from/Overrides

Inherits from Input, HTMLElement

Synopsis

                  form.name
                  form.elements[i]

Properties

Hidden inherits properties from Input and HTMLElement and defines or overrides the following:

value

A read/write string that specifies arbitrary data passed to the web server when the form containing the Hidden object is submitted. The initial value of value is specified by the value attribute of the <input> tag that defines the Hidden object.

HTML Syntax

A Hidden element is created with a standard HTML <input> tag:

<form>
    ...
  <input
    type="hidden"      // Specifies that this is a Hidden element
    [ name="name" ]    // A name you can use later to refer to this element
                       // Specifies the name property
    [ value="value" ]  // The value transmitted when the form is submitted
                       // Specifies the initial value of the value property
  >
    ...
</form>

Description

The Hidden element is an invisible form element that allows arbitrary data to be transmitted to the server when the form is submitted. You can use a Hidden element when you want to transmit information other than the user’s input data to the server.

When an HTML document is generated on the fly by a server, another use of Hidden form elements is to transmit data from the server to the client for later processing by JavaScript on the user’s side. For example, the server might transmit raw data to the client in a compact, machine-readable ...

Get JavaScript: The Definitive Guide, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.