9
rated 0 times
[
13]
[
4]
/ answers: 1 / hits: 76886
/ 11 Years ago, wed, may 8, 2013, 12:00:00
I have a really simple problem.
How can I find the first previous element of another element? I tried the code below without success.
HTML:
<div class = A>HERE</div>
<div class=B>
<div class=C style=width:50px;height:50px;background-color:#000000;></div>
</div>
JS:
$('.C').click(function() {
alert($(this).closest('.A').html());
});
Fiddle: http://jsfiddle.net/Mcujp/4/
More From » jquery