paulbennett
paulbennett

Reputation: 90

Mootools each() strange behaviour in IE6/7

I have a very simple piece of Mootools code to inject an element into every element with a certain class - this works without fault on Chrome, FF, IE8 and 9, however in 6 and 7 strange things happen.

In IE6 the element is injected but doesn't render, and as far as I can tell in IE7 the element isn't injected at all. Does anyone know why this might be?

All I'm doing to do the inject is

var topTable = new Element('table.top');

$$('.box_rounded').each(function(el, index) {
    topTable.clone().inject(el, 'top');
});

I have a simple example here http://jsfiddle.net/bstZQ/2/

Upvotes: 0

Views: 87

Answers (1)

Dimitar Christoff
Dimitar Christoff

Reputation: 26165

to render a table in IE6/7 you need to populate it.

var topTable = new Element('table.top[html=<tbody><tr><td>hi</td></tr></tbody>]');

and it renders just fine. http://jsfiddle.net/bstZQ/5/

Upvotes: 2

Related Questions