我正在尝试一个示例来学习如何从下一个和上一个 div 中获取“a tag”的属性“href”。考虑我单击 div id="rw2" 中的“a 标签”,我需要在 prev div#rw1 和 next div#rw3 中获取标签的 href。
<div class="plist" id="rw1">
<div class="image">
<a href="1.html">1</a>
</div>
<div class="some"></div>
<div class="few"></div>
</div>
<div class="plist" id="rw2">
<div class="image">
<a href="2.html">2</a>
</div>
<div class="some"></div>
<div class="few"></div>
</div>
<div class="plist" id="rw3">
<div class="image">
<a href="3.html">3</a>
</div>
<div class="some"></div>
<div class="few"></div>
</div>
......
期待结果
#rw1 .image a clicked - next = '2.html' & Prev = ''
#rw2 .image a clicked - next = '3.html' & Prev = '1.html'