I am using jQuery with jQTouch.
I have a unordered list with id="propertylist" that I am populating dynamically via .load
html...
<div id="searchpropertytype">
<div class="toolbar">
<h1><small>Properties</small></h1>
<a href="#" class="back">Back</a>
<a class="button flip" href="#home">Home</a>
</div>
<ul id="propertylist" class="rounded"></ul>
</div>
Here is Javascript to load my items...
$('#searchpropertytype').bind('pageAnimationEnd', function(e, info) {
if (info.direction == "out") return;
$('#propertylist').load('services/GetProperties.aspx?searchPropertyType=' + searchPropertyType + ' li');
});
Here is what the html looks like after I load the items...
<div id="searchpropertytype" class="current">
<div class="toolbar">
<h1><small>Properties</small></h1>
<a href="#" class="back">Back</a>
<a class="button flip" href="#home">Home</a>
</div>
<ul id="propertylist" class="rounded">
<li class="livepropertyli"><a class="livepropertya" href="#searchproperty">6000 SqFt Available Immediate</a></li>
<li class="livepropertyli"><a class="livepropertya" href="#searchproperty">1 SqFt Available Immediate</a></li>
<li class="livepropertyli"><a class="livepropertya" href="#searchproperty">2 SqFt Available </a></li>
<li class="livepropertyli"><a class="livepropertya" href="#searchproperty">3 SqFt Available </a></li>
<li class="livepropertyli"><a class="livepropertya" href="#searchproperty">4 SqFt Available </a></li>
</ul>
</div>
Everything works great except I can't figure out how to respond to the click event of my items. I have tried every selector I can think of and nothing works.
Shouldn't this work?
$('#propertylist li a').live('click', function() {
alert(".live() events!");
});