[jQuery] selecting an appended element

[jQuery] selecting an appended element


-----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
alexander.s.alexandrov@gmail.com
-----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-----