The Data Attribute
Retrieve Value of the Custom Attribute
It can also even be used in your CSS, like for this silly and lame CSS text changing example.<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Sort of Lame CSS Text Changing</title> <style> h1 { position: relative; } h1:hover { color: transparent; } h1:hover:after { content: attr(data-hover-response); color: black; position: absolute; left: 0; } </style> </head> <body> <h1 data-hover-response="I Said Don't Touch Me!"> Don't Touch Me </h1> </body> </html>
The Data Attribute
Reviewed by Bhaumik Patel
on
7:10 AM
Rating: