I have this code:
<ul>
<li class="foo">foo text</li>
<li class="foo2">foo2 text</li>
<!-- more li here -->
<li class="bar">bar text</li>
<li class="bar2">bar2 text</li>
<!-- more li here -->
<li class="baz">clickme!</li>
</ul>
and
$(".baz").click(function() {
alert("test: " + $(this).siblings(".bar")[0].text()); // Doesn't work
});
siblings(".bar")[0]
doesn't work. (no alert box pops up, and no javascript error)
What is the proper way to select one sibling only ?
Edit: I don't want to use prev()
or next()
.