Frage

Ich verwende jQTouch mit dem AJAX Beispiel in der Demo zur Verfügung gestellt:

$('#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'});
            }));
    }
});

Das gibt dann einen schönen UL, die gerade fein gibt ..

<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>

Dies ist, wo ich stecken. Wie kann ich es dann machen, so, wenn Sie auf den Link oben klicken, es die URL lädt in der Nähe der Klasse gewickelt = „Title“?

Ich mag es jQTouch wie das erste Codebeispiel zu laden.

Ich habe versucht, die folgenden zwei Dinge ohne Erfolg:

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

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

});

Danke!

War es hilfreich?

Lösung

Setzen Sie diese irgendwo außerhalb Ihrer ersten bind Funktion

$("span[class=Title]").delegate("a", "click", function(){
    alert('LOLCAT');
});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top