How can I get `data-value` using jQuery?
html, javascript, jquery
Solution
To read `data-value` attribute use below jQuery :
$("#obj-details").data('value');
and to read `country` from the `data-value` use below jQuery :
var value = $("#obj-details").data('value');
var obj = eval('(' +value + ')');
var country = obj.country;
alert(country );
Demo
Problem
How can I get `data-value` country using jQuery? I need this in variable: ``` var country = ...; ``` HTML: ``` <a id="obj-details" data-value="{city:'berlin', street: 'mozart', postal_code: '55555', country: 'DE'}">test</a> ```