문제

I'm using JQTOUCH using the AJAX example provided in the demo:

$('#customers').bind('pageAnimationEnd', function(e, info){
    if (!$(this).data('loaded')) {                      // Make sure the data hasn't already been loaded (we'll set 'loaded' to true a couple lines further down)
        $('.loadingscreen').css({'display':'block'});
        $(this).append($('<div> </div>').         // Append a placeholder in case the remote HTML takes its sweet time making it back
            load('/mobile/ajax/customers/ .info', function() {        // Overwrite the "Loading" placeholder text with the remote HTML
                $(this).parent().data('loaded', true);  // Set the 'loaded' var to true so we know not to re-load the HTML next time the #callback div animation ends
                $('.loadingscreen').css({'display':'none'});
            }));
    }
});

This then returns a nice UL which outputs just fine..

<ul class="edgetoedge">
 <li class="viewaction" id="715">
  <span class="Title"><a href="/c-view/715/">Lorem Ipsum is simply dummy text of the...</a></span>
  <div class="meta">
  <span class="dateAdded"> 1d ago </span>
  </div>
 </li>
</ul>

This is where I get stuck. How can I then make it so when you click on the link above, it loads the URL wrapped near the class="Title" ?

I'd like it to load JQTouch like the first code example.

I tried the following two things without success:

$('.viewaction').bind('click', function() {
  alert('wow');
});

$('.viewaction').live('pageAnimationEnd', function(e, info){

});

Thank you!

도움이 되었습니까?

해결책

Put this one somewhere outside your first bind function

$("span[class=Title]").delegate("a", "click", function(){
    alert('LOLCAT');
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top