jquery img select
Ich habe eine h4 mit einem img darin wie folgt. Ich binde eine Klickfunktion an den h4. Das funktioniert gut. Aber ich kann das Bild darin nicht auswählen. Ich möchte das Bild auswählen, um das src-Attribut durch .attr ("src") zu ersetzen ("up", "down"). .
<h4 class="collapsable_head">
<img id="up_down" class="icon" src="/crm/img/modifier_down.gif" alt="link"/>
<b>Classification Filter:</b>
</h4>
Das Javascript:
$(".collapsable_head").click(function(){
$(this).next(".collapsable_body").slideToggle(500)
//None of the next lines return me the img object
src = jQuery(this).children('img').attr("src");
print(src);
src = $(this).next("#up_down").attr("src");
print(src);
src = $(this).next("#up_down").attr("src");
print(src);
return false;
});
Ich möchte das Schlüsselwort "this" verwenden, da ich mehr (".collapsable_head") da draußen habe ;-)