मार्कअप:मैं पहले से चयनित तत्व पर उप चयन कैसे कर सकता हूं?
<div class="foo">
<img src="loading.gif" class="loading" style="display: none;" />
</div>
जे एस:
$("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();
});
वाह! आप $ -selector के संदर्भ को पारित कर सकते हैं! अच्छा लगा। – randomguy
@randomguy: चयनकर्ता संदर्भ मानचित्र * ढूंढें() * विधि, इसलिए '$ ('img.loading', यह)' '$ (this) .find ('img.loading') जैसा ही है। चयनकर्ता संदर्भ बहुत "अच्छा" है, मुझे लगता है। –