嗨,我發前一個div論文兩個標籤選擇由輸入
<input type="text" name="aav" class="aav"/>
<div id="aridc" class="aridc"></div>
在這種情況下
$(".aav").live("keyup",function(){
$.ajax({
type: "POST",
url: "recapVente.html",
cache: false,
data: "exp="+$(this).val()+" article",
success: function(reponse){
$(this+"~.aridc").empty();
$(this+"~.aridc").html(reponse);
},
error: function(e){
$(this+"~.aridc").empty();
$(this+"~.aridc").html("Votre recherche contien des erreurs");
}
});
});
以選擇div並sured,它是一個跟隨輸入我做這
$(".aav~.aridc")
,但是當我這樣做
$(this+"~.aridc")
我都沒有反應
請如何選擇使用
this
,而不是
.aav
這裏
$(".aav~.aridc")
感謝
股利
您可以在這裏顯示HTML和jQuery代碼? – Thulasiram
也許試試jQuery prev:http://api.jquery.com/prev/ – BiAiB
你原來的函數範圍之外! – adeneo