Skip to content Skip to sidebar Skip to footer

How To Store Javascript Object Or Json In Html Element Usiing Html5 Data Attribute?

I have anchor element.I want to store and retrive the object in it like this way. If I save in this way,while fet

Solution 1:

That's because it's not valid JSON.

Valid JSON has quoted keys and uses double quotes to delimit strings. Your example doesn't meet these requirements.

Solution 2:

That is not valid JSON, specifically you're missing quotes:

{"key1":"val1","key1":"val1"}

Post a Comment for "How To Store Javascript Object Or Json In Html Element Usiing Html5 Data Attribute?"