I want to find a class corresponding to another class within the same div.
HTML structure:
<div class="main">
<div class="party">
<a href="#"><img id="1001" class="vote" src="http://img2.jpg"></a>
<p class="votenums"> 20 votes.</p>
</div>
<div class="party">
<a href="#"><img id="1001" class="vote" src="http://imgtwo2.jpg"></a>
<p class="votenums"> 30 votes.</p>
</div>
jQuery code is:
$(function() {
$(".vote").live("click", function(e) {
e.preventDefault();
$(this).find(".votenums").text("changed text");
});
});
When I click img with class vote I want to edit the class votenums, corresponding to the same div.
meaning, the desired behavior is, when the image is clicked the text should change.
fiddle is here: http://jsfiddle.net/85vMX/1/