I need to dynamically add elements to a page, but unfortunately when I do it using the jquery .append() method, the elements seem to act differently from other elements already on the page, despite the same CSS.
I created an example page that reproduces the problem.
on the top is a list (ul
with a bunch of li
's ) with statically defined items. Below the hr is a ul
set up the same way, but the li
s are added dynamically (one every 600ms). The resulting HTML looks identical to me (except for the id), but clearly the results are different:
* The spacing on the li
's is shorter
* more seriously, they don't wrap to the width of the browser: they simply cause a horizontal scroll to be added.
Can anyone explain why the results are different?
Ultimately, I want the newly-added elements to wrap to the size of their container. Seems to me like this CSS should work..