Sometimes IE does not make a new element available while the current script block is still running. If you give it a breather then it can catch up. This is most noticable when dealing with <select> elements.
Hence something like this may help (after appending the element) window.setTimeout(function(){ jQuery('.container .item').each(...) }, 0); Failing that does it make a difference to move the .show() to after the .appendTo() Also, If the item element has any child elements then you'll need to use .clone(true) instead. George PS: One other thing... using the :first selector could save you a line of code, eg: jQuery('.container .item:first') On Nov 4, 1:32 am, Alexander Alexandrov <[EMAIL PROTECTED]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello, > > I have a problem with jQuery running on IE 6 and i hope you can help me. > > I want to dynamically add / remove child elements (items) all with the > same basic structure to a <div> container. In order to do so, initially > I have the container with a hidden prototype version of the item as the > only child. When a creation of a new item is requeested i simply do > something like > > jQuery('.container .item') > .slice(0, 1) // select the prototype (first child) > .clone() // clone the prototype > .show() // display the prototype > .appendTo('.container); // append to the container > > Now, the problem is that I once insert the new item I cannot select it > using for instance jQuery('.container .item'). > > Moreover, if I want to traverse all inserted items with > > jQuery('.container .item').each(...); > > i only get the initial prototype item in IE. In FF all works fine. > > I guess the problem is the internal representation of the DOM in IE that > jQuery uses for selection is not really updated upon calling a modifying > method like append() or prepend()... > > I already tried doing document.recalc(); for ie browsers without success. > > I hope you understand the problem and can suggest a possible solution. > > Cheers, > Alex > > - -- > Alexander Alexandrov > icq: 72163091 > > [EMAIL PROTECTED] > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (MingW32) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org > > iD8DBQFHLSFEvnm3M1kXDXURAlcYAJ9nqEujo+YmJCWcl8SzWH1iUnLeRwCfQ8qP > PCrJw1dcEqbE1VpCSC+tsdI= > =0c0/ > -----END PGP SIGNATURE-----