×

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 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 Ordered List

We use <ol> tag to make an ordered list in html. An ordered list is made to make a list of items in ordered form, ordered list can be either...

3 minutes read.

HTML <samp> tag

The Samp tag in HTML is used for defining the sample output from the computer program. This tag is a phrase type tag and a container tag that means the...

2 minutes read.

How to add JavaScript to HTML

JavaScript is one of the most important languages today. It is a high-level, interpreted, lightweight programming language that makes web pages more interactive. It is a language of the web....

5 minutes read.

HTML <strong> tag

The strong element in HTML is used to display the real significant information in bold so that the user or reader will understand it easily. Syntax: <p> <strong>………… </strong> </p> Example Here, we will demonstrate how to...

2 minutes read.

Html &lt;datalist >Tag

The autocomplete feature in HTML files is provided by the <datalist> tag. It can be used in conjunction with an input tag to enable users to quickly fill out form...

4 minutes read.

HTML Date

The input element in HTML has several attributes. One of its attributes is the type attribute which creates a calendar in an order that a user can select a date...

5 minutes read.

What is a Container tag?

In HTML, there are different types of tags or say instructions which make the developer specify various elements in the document and make the browsers understand what to display. Tags in...

5 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 Anchor

HTML Anchor The HTML anchor tags define a hyperlink that links to other pages on one page. It can create hyperlinks to any web page and files, locations or any other...

3 minutes read.

HTML Event Attributes

HTML Event Attributes If a browser responds to the user behavior, an event is called. For example, if we click on the submit button, a box of details will appear on...

4 minutes read.

Div Tag in HTML

In HTML, ‘div’ is a tag that specifies division or section in HTML document. But before going in detail of it, let’s first understand about tags in HTML. The tag...

8 minutes read.

HTML <table> tag

The Table element If we want to show the data and information in a two-dimensional table with rows and columns, then we can achieve this by using the HTML element <table>. Syntax: <body> <table> <thead> <tr> <thcolspan="#">………….</th> </tr> </thead> <tbody> <tr> <td>……….</td> <td>……….</td> </tr> </tbody> </table> </body> Example: <!DOCTYPE...

9 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.

How to change font in HTML

To give style to the content of your website, you may change the font of the text and make your website look attractive to the user. There are several methods which...

4 minutes read.

HTML Font Size

The HTML <font> tag uses the size attribute to specify the size of the text. We can set the size attribute’s value from 1 to 7. The default size of...

4 minutes read.

HTML Layouts

HTML Layouts HTML templates provide a way for well-managed, well-structured responsive web pages to be organized. We could say that the HTML layout specifies how web pages can be set up....

4 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 Hide Element

The HTML hide element is used to hide the element. We place the hidden attribute inside those elements which we want to hide. The hidden attribute is a Boolean attribute. The...

3 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.