Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のようなシーケンスにいくつかの div 要素があります。
<div id="a"></div> <div id="b"></div> <div id="c"></div> <div id="d"></div>
である3番目の位置のdivのIDがあるとしcます。ここで、id がc. jqueryでこれを行うにはどうすればよいですか?
c
あなたが使用することができ.prev()ます.next()
.prev()
.next()
$('#c').prev(); $('#c').next();
http://jsfiddle.net/MAd2K/
あなたはこのようにすることができます
$('#c').prev('div'); $('#c').next('div');
ライブデモ
</p>