×

HTML Data Tag

HTML Data Tag: The HTML < data > tag is used to transmit its content to a machine-readable version. The data are presented in a particular format. It is useful because a script can process it, but this might not be the format we would like the users to use.

Let's consider a scenario:

Suppose we have to represent some numbers with letters (i.e., one, two, three, and so on) to our users, but we have a script that sorts the numbers in ascending or descending commands. So our script needs amounts in a format like 1, 2, and 3, and so on.

To solve the problem, < data > tag is used.

For users: write within tag < data>.... </data >.

For the script: use the attribute value.

<data value=”1”One</data>

HTML data tag attribute

There is only one required attribute. The Data tag also supports global attributes and event attributes.

AttributeDescription
ValueIt is a required attribute. It is used to provide content for the computer-readable version of the name.

HTML data tag example

<!DOCTYPE>
<html>
<body>
<ul>
<li><data value="101">Java Tutorial</data></li>
<li><data value="111">SQL tutorial</data></li>
<li><data value="121">HTML tutorial</data></li>
<li><data value="131">HTML Hadoop Tutorial</li>
</ul>
</body>
</html>

Output

HTML Data Tag

Supporting Browsers

ElementChromeIEFirefoxOperaSafari
<data>YesYesYesYesYes

HTML Datalist Tag

The HTML < datalist > tag is used to provide a complete auto function on the form element. It provides users with a list of predefined options for selecting data.

HTML5 includes the datalist tag.

The tag < datalist > should be used with the element < input >, which contains the attribute "list." The value of the "list" attribute is related to the Datalist Id.

Example

Let's look at the simple example of the data list tag HTML5. If you press A, a list of cricketers will appear, starting with A letter.

<!DOCTYPE>
<html>
<body>
<label>
 Enter your favorite cricket player: Press any character<br />
<input type="text" id="favCktPlayer" list="CktPlayers">
<datalist id="CktPlayers">
<option value="Mahendra Singh Dhoni ">
<option value="ViratKholi">
<option value="Rohit Sharma">
<option value="Ricky Ponting">
<option value="Rahul Dravid">
<option value="ShikherDhawan">
<option value="Surash Raina">
<option value="Donald Bradman">
<option value="SauravGanguly ">
<option value="AB diVilliers">
<option value="RavindraJadeja">
<option value="Adam Gilchrist">
</datalist>
</label>
</body>
</html>

Output

HTML Data Tag
HTML Data Tag

Supporting Browser

ElementChromeIEFirefoxOperaSafari
<datalist>YesYesYesYesYes

HTML Dialog tag

Log > tag is used to create a new web-page popup dialog. This tag is a dialog box or some interactive feature like a window. The < dialog > element uses the open boolean attribute that activates the component and makes it easier for the user to interact.

A new tag implemented in HTML5 is the HTML dialog.

HTML dialog tag example

<!DOCTYPE>
<html>
<body>
<div>
<dialog id="myFirstDialog" style="width:50%;background-color:#F4FFEF;border:1px dotted black;">
<p><q>I am so clever that sometimes I don't understand a single word of what I am saying.  
</q> - <cite>Oscar Wilde</cite></p>
<button id="hide">Close</button>
</dialog>
<button id="show">Show Dialog</button>
</div>
<!-- JavaScript to provide the "Show/Close" functionality -->
<script type="text/JavaScript">
(function() {   
var dialog = document.getElementById('myFirstDialog');   
document.getElementById('show').onclick = function() {   
dialog.show();   
    };   
document.getElementById('hide').onclick = function() {   
dialog.close();   
    };   
})();  
</script>
</body>
</html>

Output

HTML Data Tag

The HTML Dialog tag also supports HTML attributes for global and events.

Supporting Browsers

ElementChromeIEFirefoxOperaSafari
<dialog>YesYesYesYesYes

Related Topics

Html &lt;Col> Tag

You can write the col tag inside the table tag after the thead, tbody, foot, and tr tags. You can also apply it after the caption tag (in which the...

4 minutes read.

Most Commonly used Tags in HTML

In this tutorial, we'll look at the most popular HTML tags. We know HTML is a fundamental requirement for creating a website. As a result, it is essential to remember...

9 minutes read.

HTML <section> tag

The section element in HTML is used to define sections in a document. Syntax of Section Tag: <body> <h1>……….</h1> <section> <h2>……….</h2> <p> …………………………</p> </section> <section> <h2>………..</h2> <p>…………………………. <p> </section> </body> Examples of Section Tag Example 1: In this example, we use the HTML "section" element...

3 minutes read.

HTML Id Attribute

The HTML id attribute represents the unique identifier for an element of the HTML document. Each element has its unique identifier. The id attribute is a global attribute that can be...

12 minutes read.

HTML Font Color

The HTML <font> tag has an attribute called color, which defines the color of the text. We use the color attribute inside the <font> tag to specify the color of...

6 minutes read.

HTML Attributes

HTML Attributes provide the additional information about HTML elements. Attributes are always specified in the start tag. Attributes usually comes in pairs. lang Attribute This attribute helps in declaring the language...

2 minutes read.

HTML Background Image

Inserting image in HTML An image (technically digital image) in HTML or even in general technical aspects, is a binary representation of visual information. By visual information we mean, in the...

8 minutes read.

Font tag in HTML

HTML stands for Hypertext Mark-up Language and is used to create web pages and other information that can be later displayed in a web browser. It also consists of a...

4 minutes read.

HTML &lt;blink> Tag

In HTML, the blink tag is used to create the text which flashes. The blink tag is an inline element in HTML. It is observed that the blink tag used...

2 minutes read.

HTML Tutorial

Introduction This HTML tutorial helps beginners and professionals to learn HTML easily. HTML is a widely used web technology for website development. It stands for Hyper Text Markup Language. It is mainly used to...

7 minutes read.

HTML Form Input Types

HTML Form Input Types An important element of the HTML form is < input type= "> in HTML. The type attribute of the input element can be of different types, which...

8 minutes read.

HTML Images

HTML has <img> tag to display image on the web pages or web application. This tag is an empty tag i.e. we don't have to close this tag while using. SYNTAX: <img src="source address" attributes="alt, height, width"> Example: <html>   <body>   <center>Image tag Example</center>   <img src="https://www.tutorialandexample.com/resources/images/favicon.png"    alt="tutorialandexample"/>   </body>   </html> Output: Image...

1 minute read.

HTML5 Tags

HTML5 Tags A list of newly included tags is provided in HTML5. These HTML 5 tags (elements) provide a better structure for the document. This list shows description of all HTML...

3 minutes read.

HTML Frames

Frames in Html is used to divide the browser into different sections where each section can load different Html documents. Collection of frame is known as Frameset. Creating frames:We use frameset...

2 minutes read.

HTML City tag

HTML <City> tag HTML < cite > tag specifies a citation, a reference or title to a creative work, quoted content, books, websites, a research paper, a blog post, a painting,...

3 minutes read.

Html Wbr Tag

The Line Break Opportunity element A word break opportunity is a place in text from where the browser breaks a line. This opportunity is represented by the element wbr in the...

2 minutes read.

HTML Lists

HTML List HTML lists are used to specify data sets. All lists can include one or more elements from the list. HTML lists are available in three different types: Ordered List or...

4 minutes read.

HTML Data Tag

HTML Data Tag: The HTML < data > tag is used to transmit its content to a machine-readable version. The data are presented in a particular format. It is useful...

3 minutes read.

HTML References

BASIC HTML TAGS TAGS DESCRIPTION <!DOCTYPE> Defines Document Type <html> Defines Html document <head> Defines Header of document <title> Defines Title of document <body> Describe all the content of document <h1> to <h6> Defines Html Heading <p> Write Paragraph in this tag <br> Line break <!--...--> Comment in Html FORMATTING TAGS TAGS DESCRIPTION <abbr> Defines...

3 minutes read.

HTML 5 Tutorial

What is HTML5? HTML5 is a programming language which stands for the acronym Hyper Text Markup Language 5. It is program that enables the appearance of web pages to be changed, as well as changes...

5 minutes read.