View Full Version : Populating A List With PHP - Not Working.

30 Nov 2010, 11:59 PM
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:

<div class="toolbar">
<ul id="names">

document.write("<li id='a3'><ahref='#dispName'>hello</a></li>");
<li id="a1"><ahref="#dispName">Andrew</a></li>

<li id="a2"><ahref="#dispName">Anita</a></li>
<li id="a3"><ahref="#dispName">Arnold</a></li>

Calling the dispName() function

var placeID;

$('#names a').click(function(){
//$('#dispName h1').html($(this).text());
placeID = $(this).parent().attr('id');

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.