Hey,
I have been working on an iPhone app that requires me to dynamically change the content. I have the following code:
<div id="home">
<div class="toolbar">
<a class="blueButton" href="javascript: void(0);" onClick="$('#logout').show();">Logout</a>
<h1>AllaccessMD</h1>
</div>
<h1>Home</h1>
<ul class="edgetoedge" id="ulHome"></ul>
</div>
When this page gets called I call the javascript function:
function setupHome(){
if(localStorage.role == "Specialist"){
var homeUL = '<li class="arrow"><a id="s,' + localStorage.userID + '" href="#ePresentations">My E-Presentation</a></li>'
+ '<li class="arrow"><a id="s,' + localStorage.userID + '" href="#date">My Newsletter</a></li>'
+ '<li class="arrow"><a id="s,' + localStorage.userID + '" href="#date">My Events</a></li>'
+ '<li class="arrow"><a id="s,' + localStorage.userID + '" href="#date">Medical Partners</a></li>'
+ '<li class="arrow"><a id="s,' + localStorage.userID + '" href="#date">Search</a></li>'
+ '<li class="arrow"><a id="s,' + localStorage.userID + '" href="#date">Profile</a></li>';
$('#ulHome').html(homeUL);
} else {
var homeUL = '<li class="arrow"><a id="m,' + localStorage.userID + '" href="#date">Medical Partners</a></li>'
+ '<li class="arrow"><a id="m,' + localStorage.userID + '" href="#date">Search</a></li>'
+ '<li class="arrow"><a id="m,' + localStorage.userID + '" href="#date">Profile</a></li>';
$('#ulHome').html(homeUL);
}
$('#ulHome li a').click(function(){
alert('I dont see this alert on a iPhone!');
if(this.href.search("#ePresentations") != 0) {
var idObject = getID(this.id);
setupEPresentation(idObject.id);
}
});
}
This all works fine except the $('#ulHome li a').click() doesn't work. It works fine on Firefox and Chrome, but not on a iPhone.
Where did I go wrong? OR is there a better way to implement this?
Thanks!