Take this data attribute as an example.
<div id="element" class="element" data-name="Mary"></div>
Get the data attribute.
//get data-id using jQuery
var dataName = $('#element').data('data-name');
console.log("dataName"); // Mary
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.