Im trying to get data out of a data attribute using jquery.
Heres what I have:
<div id="x" data-foo="{top:'100', left:'40', width:'50'}">
and in javascript:
x = $('#x').data();
console.log( x.foo.top ) //undefined
Ive tried JSON parse as well, but I get errors about unexpected tokens then.