I want to give the java script object structure as text input into the inputTextarea and i want a var to read that as object. My object structure is like below. Instead of giving this in the inputTextarea i can give this directly in my xhtml page as var obj={ onchange: ... but that i don't want. Because there are difficulties in parsing the xml tags also, else it will throw some tag errors. Is that possible to read the text from inputTextarea as var object instead of reading as string .
{
onchange: function(){
console.log("I been changed now!")
},
validate: function(obj){
console.log("I be validatin' now!")
},
elements: {
"list": {
menu: [{
caption: "Append an <item>",
action: Xonomy.newElementChild,
actionParameter: "<item/>"
}]
},
"item": {
menu: [{
caption: "Add @label=\"something\"",
action: Xonomy.newAttribute,
actionParameter: {name: "label", value: "something"},
hideIf: function(jsElement){
return jsElement.hasAttribute("label");
}
}, {
caption: "Delete this <item>",
action: Xonomy.deleteElement
}, {
caption: "New <item> before this",
action: Xonomy.newElementBefore,
actionParameter: "<item/>"
}, {
caption: "New <item> after this",
action: Xonomy.newElementAfter,
actionParameter: "<item/>"
}],
canDropTo: ["list"],
attributes: {
"label": {
asker: Xonomy.askString,
menu: [{
caption: "Delete this @label",
action: Xonomy.deleteAttribute
}]
}
}
}
}
}