I am trying to access the data attributes in js. But displays the error="Uncaught type error"
var x=document.getElementById(this.id);
console.log(x.src);
console.log(x.data('image'));
for x.src I m getting perfect-"http://localhost:3000/uploads/asset/asset3/199/small_ring3.jpg", but when I try for x.data('image'), it displays - "Uncaught TypeError: undefined is not a function58:646 (anonymous function)jquery.min.js:3 m.event.dispatchjquery.min.js:3 m.event.add.r.handle"
here x is
img alt="Small ring3" class="img-thumbnail" data-image="/uploads/asset/asset3/199/large_ring3.jpg" id="2" src="http://localhost:3000/uploads/asset/asset1/199/large_ring1.jpg"
Please help.