Returns the given element's [up-data]
, parsed as a JavaScript object.
Returns undefined
if the element has no [up-data]
attribute.
You have an element with JSON data serialized into an up-data
attribute:
<span class='person' up-data='{ "age": 18, "name": "Bob" }'>Bob</span>
Calling up.syntax.data()
will deserialize the JSON string into a JavaScript object:
up.syntax.data('.person') // returns { age: 18, name: 'Bob' }