我有以下 DOM 结构:
<label>
<span class="tt">
<a href="#" class="editable">Hello1</a>
<a href="#" class="editable">Hello2</a>
<a href="#" class="editable">Hello3</a>
<a href="#" class="editable">Hello4</a>
</span>
<a href="#" class="editable">Hello5</a>
</label>
当我点击锚点Hello3
时,我需要得到Hello4
它并且它工作得很好。但是如果我点击链接Hello4
,我需要得到Hello5
我没有得到正确的链接。
我正在使用以下代码:
$(document).on('click','.editable',function(){
console.log($(this).nextAll('.editable').first());
});
我真正想要的是editable
当我点击一个锚点时,在标签标签中获得下一个具有 class of 的元素。