标记:
<div class="foo"> <img src="loading.gif" class="loading" style="display: none;" /> </div>
JS:
$("div[class='foo']").click(function(e) { e.preventDefault(); $(this).hide(); $(/* somehow select the loading img of exactly this div with class foo (not others) */).show(); });
解决方法
$("div[class='foo']").click(function(e) { e.preventDefault(); $(this).hide(); $('img.loading',this).show(); });