How to set JSON format to HTML5 data attributes in the jQuery
In order to be parsed as an object, the data attribute must be a well formed JSON object. In your case you just need to quote the object keys (as you do in the second object). Try: <div data-params=”{“a”: 1, “b”: “2”}” id=”TEST1″></div> For more info see the data method docs, the relevant part is … Read more