Impossible d'obtenir jQuery gestionnaire de clic pour tirer sur l'élément chargé ajax

StackOverflow https://stackoverflow.com/questions/2146661

  •  23-09-2019
  •  | 
  •  

Question

"MyParentPage.htm" utilise la fonction de charge pour charger jquery ( 'myDiv.htm') //

myDiv.htm ne contient que:

<a href="#" class="bt-cbox">Click me</a>

J'ai ce qui suit dans "MyParentPage.htm"

$(document).ready(function() {    
    $(".bt-cbox").click(function() {    
        alert("handler hit");
    });
});

Pourquoi le mon alerte ne pas être touché

Était-ce utile?

La solution

$(document).ready(function() {
    $(".bt-cbox").live("click",function() {
        alert("handler hit");
    });
});

Voir vivre

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top