DEMO
How to update B text when C is clicked?
HTML
<div class="A">
<div><span class="B">TEXT</span></div>
<div>
<div id="C" onclick="tx(this.id);">CLICK ME</div>
</div>
</div>
JQUERY
function tx (e){
$('#' + e).closest('.A').children('.B').text('SUCCESS');
}
I cant understand why the above jquery does not work.
It should find nearest parent then child.