There’s a HTML:
<div class='test'> <ul> <li>Item 1</li> <li>Item 2</li> </ul> </div>
And a bit of JS:
$(document).ready(function() { // do stuff when DOM is ready $('.test ul').append('<li>Foo</li>'); });
Why does it add nothing, but if I remove html from append’s argument string,
.append('Foo')
it works – but that’s not the point – new text is added as anonymous block, not li item as I wanted.
Anu suggestions?
edit: Argh, I’ve found the problem. I modified a file saved from Firefox’s ‘Save page’ option, the extension was .xhtml – and here’s the problem. I renamed it and it works fine.
Thanks 🙂
I checked your code and it works perfectly on my machine… So I think it’s not jQuery bug.