我有看起来像的 HTML。
<ul>
<li>
<a id="MP0003631" class="pheno" href="#">nervous system phenotype</a>
</li>
<ul>
单击后,JQuery 如下所示:
$(".pheno").on("click", function(){
var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "treescript.php",
data: { pheno: id}
}).done(function( msg ) {
$('#'+id).after("<br>"+msg+"");
alert(id);
});
});
将创建如下所示的 HTML:
<ul>
<li>
<a id="MP0003631" class="pheno" href="#">nervous system phenotype</a>
<ul>
<li>
<a id="MP0003632" class="pheno" href="#">abnormal nervous system morphology</a>
</li>
<li>
<a id="MP0003633" class="pheno" href="#">abnormal nervous system physiology</a>
</li>
</ul>
</li>
</ul>
问题是,正在创建的内容没有被 JQuery 识别。这可能吗?