I've faced two strange attributes of an html tag . They are "data-url" and "data-key".
What are they and how can they be used?
For some reasons i can't show the exact example of the HTML file I've found them in, but here are some examples from the web with such tags:
PS: I've tried to Google, but no useful results were found.
When Should I Use the Data Attribute?
Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements.
This time the data attribute is used to indicate the bubble value of the notification bubble.
<a href="#" class="pink" data-bubble="2">Profile</a>
This time is used to show the text for the tooltip.
<a href="#" class="tooltip" data-tip="this is the tip!">This is the link</a>
When Shouldn’t I Use the Data Attribute?
We shouldn’t use data attributes for anything which already has an already established or more appropriate attribute. For example it would be inappropriate to use:
<span data-time="20:00">8pm<span>
when we could use the already defined datetime attribute within a time element like below:
<time datetime="20:00">8pm</time>
Using Data Attributes With CSS (Attribute selectors)
[data-role="page"] { /* Styles */ }
Using Data Attributes With jQuery (.attr())
<a href="http://www.google.com" class="button" data-info="The worlds most popular search engine">Google</a>
$('.button').click(function(e) { e.preventDefault(); thisdata = $(this).attr('data-info'); console.log(thisdata); });
Examples and info from here
Those are called HTML5 Custom Data attributes.
Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements. These attributes are not intended for use by software that is independent of the site that uses the attributes. Every HTML element may have any number of custom data attributes specified, with any value.
The reason why you can't find it in Google is because those attribute are custom attributes generated by user for their own usage.
From seeing your code it seems:
The person who has written this code, wants to store some additional information with the elements. Not sure he may handle this in Javascript
too.
What you should do is to check the Javascript
code completely, whether he is handling those data attributes or if possible check with him.
jQuery
library, check for .data() method. After a complete code review, if you find it has no use, then feel free to remove.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With