setting data attribute values in javascript

12:49 am, October 9, 2018
a data attribute is something like this, you can pretty much call it whatever you want.
<div my-data-attribute='something'></div>
this is how you can set them and delete them using plain js. this demo sets a data attribite and then retrieves it logging the value to the console window.

Code

html
css
js
scripts

Download & Run

Download File Run Demo Re-load Preview

Preview

AYbZ4