Skip to content Skip to sidebar Skip to footer

Prototypejs Element.prototype.appendchild Issue

Due to Ajax loaded content, I had to change a function from: document.observe('dom:loaded',function() { $$('.userListHeaderCell').invoke('observe', 'click', function() {

Solution 1:

Since it is my code that is failing I should have a go.

The line,

}).each(Element.prototype.appendChild, content);

is a shorthand way of saying,

}).each(function(row) {
    content.appendChild(row);
});

You can try it that way to see if things are better. I don't recognise the error but a quick google suggests it is from Firefox and relates to passing a non-element to a native function that expects one. In situations such as this I tend to stick lots of console.log(...) calls everywhere (and press F12 in Firefox) and see what happens. Logging the array should show all the rows as HTML elements.

Post a Comment for "Prototypejs Element.prototype.appendchild Issue"