tb_scooter
New Member
I am currently working in building a jQuery object hierachy through Javascript, but I keep hitting a strange issue, when I parse my HTML I can fetch and store different values, but as soon a I start using arrays I have a problem:here is the console output \[code\]Object {children: Array[0], id: 1, level: 1}\[/code\]But when I unfold it I get the following: \[code\]children: Array[3]id: 1level: 1__proto__: Object\[/code\]Which is the actual value the key children should haveI can't access the content of the object.Here is a fragment of relevant code :\[code\]$.elementSort = function(ref, options) { var plugin = this, defaults = {}, $element = $(ref), element = ref, data = http://stackoverflow.com/questions/15526427/{} //... plugin.setParent = function (parent) { parent.addChild(this); data.parent = parent; } plugin.addChild = function (child) { // a console.log of data['children'] here returns the expected content return data['children'].push(child()); } plugin.getChildren = function() { return data['children']; } plugin._toString = function () { var out = this.getLabel() + '\n'; out += 'id : ' + this.getId() + "\n"; out += 'level : ' + this.getLevel() + "\n"; out += 'children : ' + this.getChildren().length + "\n"; // display 0 if (plugin.getParent() != undefined) { out += 'parent : ' + this.getParent().getLabel(); } return out; } //... init(options);};\[/code\]