Я хочу index () работает только с определенным html-тегом .row
Но сейчас index () запускает всеDOM, и дай мне все .twocol в документе.
У меня есть полный пример здесь: http://jsfiddle.net/brunogarcia/SRUkt/ Почему?
$("a.mostrar").live("click", function(event) {
alert($(this).parent(".row .twocol").index(".row .twocol"));
<div class="row">
<h3>Row 1</h3>
<div class="twocol"><a href="" class="mostrar">text</a></div>
<div class="twocol"><a href="" class="mostrar">text</a></div>
</div>
<div class="row">
<h3>Row 2</h3>
<div class="twocol"><a href="" class="mostrar">text</a></div>
<div class="twocol"><a href="" class="mostrar">text</a></div>
</div>