1
我有HTML代碼:如何使用jQuery每種方法發佈每個圖像的值?
<div>
<span class="image" id="img-1"></span>
<span id="src-1">img-src-1</span>
<span id="cmd-1">img-cmd-1</span>
<span id="h1-1">img-h1-1</span>
<span id="h2-1">img-h2-1>
</div>
<div>
<span class="image" id="img-2"></span>
<span id="src-2">img-src-2</span>
<span id="cmd-2">img-cmd-2</span>
<span id="h1-2">img-h1-2</span>
<span id="h2-2">img-h2-2>
</div>
和其他增加的div像IMG-3,IMG-4,IMG-5 .....與相關值
,這是我的javascript:
$('.image').each(function() {
$.post("../../includes/processes/show-images.php", {
width : $(this).parent().width(),
img_src : $(this).next().text(),
cmd : $(this).next().next().text(),
h1 : $(this).next().next().next().text(),
h2 : $(this).next().next().next().next().text()
},
function(response){
$(this).parent().html(response);
});
});
return false;
我想爲每個「.image」元素髮布其值,並在「.image」.parent()中返回響應,但我的代碼不起作用。 :-(
有人可以幫我請