我已经做了简单的ajax调用。 E =元件在其上我点击jQuery焦点不能集中于ajax加载的元素
<div class="row">
<div class="order_notes">
<div class="order_note add">
<div class="input"><input type="text" value="" /></div>
<div onclick="someFunction(e)">click it</div>
</div>
<div class="order_note">note</div>
</div>
</div>
该结构装有Ajax和AJAX后,我希望把重点放在输入文本再次
function someFunction(e){
jQuery.ajax({
type: "POST",
url: "/templates/design/inc/al_ajax.php",
data: { action : 'add_note', order_number: o_num, commentar: com, user_id: user_id},
beforeSend: function(data){
},
success: function(data){
e.closest(".row").find(".order_notes").html(data);
console.log(e.closest(".row").find(".order_notes .add input").length);
e.closest(".row").find(".order_notes .add input").focus();
}
});
}
的console.log返回1,因此元素存在哪里是问题请。同时数据是正确的,它正确地改变order_notes 包括输入的一切,所以我需要把重点放在加载输入
PS:在strucutre比较复杂,我只是简化它例如
定义是什么'e'里面?你能看到数据吗? – 2014-08-27 12:33:10