asp.net.ph

Skip Navigation Links

DATA Element | DATA Object

Language References


Adds a machine-readable version for a given piece of content.HTML 5

HTML Syntax

Remarks

The DATA element is used to annotate a representation of a related element’s content in machine-readable format.

The value attribute must be present, and must contain the machine-readable translation.

The element serves to provide both a machine-readable value for the purposes of data processors, and a human-readable value for the purposes of rendering in a web browser.

Example

Here, a simple table has its numeric values encoded using the <data> element, so that a script can provide a sorting mechanism on each column despite the numbers being presented in textual form.

<script src="sort.js"></script>
<table id="sortable">
<thead>
   <tr><th>Game
      <th>Corporations
      <th>Map Size
<tbody>
<tr><td>1830
   <td><data value="8">Eight</data>
   <td><data value="93">19+74 hexes</data>
<tr>
   <td>1856
   <td><data value="11">Eleven</data>
   <td> <data value="99">12+87 hexes</data>
<tr>
   <td>1870
   <td><data value="10">Ten</data>
   <td><data value="149">4+145 hexes</data>
</table>
See Also



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note