When a li is appended, does it not become a part of the ul "for real"?

Posted by Noor on Stack Overflow See other posts from Stack Overflow or by Noor
Published on 2010-05-09T13:39:26Z Indexed on 2010/05/09 13:48 UTC
Read the original article Hit count: 236

Filed under:
|
|
|
|

I have right now this code:

<ul><li class="listitem">text<li></ul>

jQuery:

$('.listitem').click(function() {  
  $("#elname").text($(this).text());  
  $('#slists').css('visibility','hidden')  
  $('#elname').css('visibility','visible')  
  $('#elname').css('display','inline-block')  
});

This is supposed to hide a div and it does, but when I append items to the ul (with the class listitem) nothing happens with the appended item, the class it gets is correct, the title, and the value too.

Can this have something to do with the code above being in the document ready function to do?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript