A cross-browser implementation of getAttribute.
Source found here: http://stackoverflow.com/a/3755343/361337 written by Vivin Paliath
Uses default getAttribute
if it's available.
Built to be used with the Component package manager. Read more here:
$ component install javve/get-attribute
<div id="test" data-value="myValue"></div>
var getAttribute = require('get-attribute');
var el = document.getElementById('test')
var dataValue = getAttribute(el, 'data-value');
alert(dataValue); // Alerts "myValue"
Return the value for attribute
at element
.
MIT