PDA

View Full Version : Web App With PHP - problem.



lammie1971
30 Nov 2010, 12:22 PM
Hi I am in the process of creating my first app. One of the features I need is to include a php page that has interogated a Database and turned out the neccessary HTML.

I then want to be able to get the elementID and the innerText.

If I include this code:



<div class="toolbar">
<ul id="names">
<li id="a1"><a href="#dispName">Andrew</a></li>
<li id="a2"><a href="#dispName">Anita</a></li>
<li id="a3"><a href="#dispName">Arnold</a></li>
</ul>
</div>


And this:


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;
});



It works fine and I get the results I am after - but I want to append the div to what was created by querying the database.

This would output code like this.


echo('<li id="a1"><a href="#dispName">Arnold</a></li><li id="a2"><a href="#dispName">Anthea</a></li>');'


I can get the information to list fine as I want but when it is tapped/clicked upon nothing happens.

Can anyone give me any advice?

Thanks in advance.