I am looking form a nested data to a DOM element. Something like this
$("div").data( "test", {
first: 16,
last: "pizza!"
});
Here is my effort to make similar kind of format. But RefAttrValue variable is not behaving as variable.
for (var i = 0; i < reference.attributes.length; i++) {
var RefAttrValue = (reference.attributes.item(i).name);
$(tableCaption).data("referenceData").RefAttrValue = reference.attributes.item(i).value;
}
Here the Values of the "reference" is a XML. Which has value like below or can contain any similar XML.
<facilityreference Name="qtitem_fac" AttrTable='table1' colVal='table1colValue'></facilityreference>
I want to set up the data() format in this below format "Dynamically".
$("div").data("test",{ Name: "qtitem_fac", last: "table1colValue" });
Please help.