Having difficulty selecting the Li tags after the container is cached.

Having difficulty selecting the Li tags after the container is cached.

Having difficulty selecting the Li tags after the container is cached.

  1.         var res = {
  2.             loader: $('<div />', { class: 'loader'}),
  3.             container: $('.container')
  4.         }
  5.     
  6.         $('.container ul li').click(function(){
  7.             var clickval = $(this).text();
  8.             $('#eventn').val(clickval);
  9.         });
HTML output
<div class="container">
<ul>
      <li> Mall @ Carnival</li>
      <li> Carnival City </li>
</ul>
</div>