Hi, I have run into a problem trying to develop my app.

The scenario is I am populating a list via PHP to display a list of names. I can get this to work fine and display correctly. My problem lies that when a list item is tap/clicked upon I want to gain the id and innerText of that item, i.e, <li id='bloggs'>Joe Bloggs</li>.

If I perform this task with a static list using this code it works fine:

HTML Code:
<div class="toolbar"> 
      <ul id="names"> 
      <script>
 
          document.write("<li id='a3'><ahref='#dispName'>hello</a></li>");
          </script>
      <li id="a1"><ahref="#dispName">Andrew</a></li>
 
      <li id="a2"><ahref="#dispName">Anita</a></li> 
      <li id="a3"><ahref="#dispName">Arnold</a></li> 
      </ul> 
</div>
Calling the dispName() function

HTML Code:
var placeID;   
 
    $('#names a').click(function(){   
     //$('#dispName h1').html($(this).text());   
     placeID = $(this).parent().attr('id'); 
       alert(placeID); 
 
 
 
        alert(document.getElementById(placeID).innerText );
 
        //jQT.goTo('#dispName', 'slide');      
     return false;  
    }); 
But if I am to import the list via PHP and output the same code and list it doesn't work - which I need to do as the list will be constantly evolving.

Has anyone any ideas.