IDREF Attribute Type


 

The IDREF Attribute Type is defined by the W3C XML 1.0 Recommendation.
Reference: *W3C - XML 1.0 - Attribute Types

Specific Attributes with Type IDREF

  1. for:
    This is declared on the element: label
  2. usemap:
    This is declared on the elements: object, img, input type="image"

Common Attributes with Type IDREF

There are no Common Attributes with type IDREF.


Attribute Value for Type IDREF

A reference to an element identifier of type ID

The IDREF Attribute Type allows an element with such an attribute to refer to another element by its id.

For example, a label element may have a for attribute (of type IDREF) which refers to the id of the input (or select, textarea etc.) element for which it is a label. The code below shows how a label may be assigned to an input type="text" element:

<label for="namefield">Name:</label>
<input type="text" id="namefield" name="name" value="Your Name" size="20" />

The value of an attribute with Type IDREF must correspond to the value of an existing id attribute in the document. If it does not W3C Validation will result in a warning. (Interestingly, it is only a warning which is generated and not an error - despite the *XML 1.0 Validity Constraint for IDREF.)


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 01 Oct 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > Data Types in XHTML 1.1 > Attribute Types (XHTML 1.1) > IDREF Attribute Type