HOME > > > > >

prev + next

prevの後のnextを選択する。子供ではなく兄弟関係にあるやつ。

サンプル

実行結果

リストの見出し

jQueryのてすと

  • リスト1
  • リスト2

test

aaaa

Javascript

  1. $('.execute').click(function(){
  2.     $('div + img', $(this).parent()).css({
  3.         display: 'inline-block',
  4.         padding: 5,
  5.         border: '1px solid #009999'
  6.     });
  7. });

HTML

  1. <div class="jqTest">
  2.     <input type="button" value="jQuery *テスト" class="execute" />
  3.  
  4.     <h5>リストの見出し</h5>
  5.  
  6.     <p>jQueryのてすと</p>
  7.  
  8.     <ul>
  9.         <li>リスト1</li>
  10.         <li>リスト2</li>
  11.     </ul>
  12.  
  13.     <p><span>test</span></p>
  14.  
  15.     <div>aaaa</div>
  16.  
  17.     <img src="/resource/icons/comment.gif" />
  18.     <input type="text" name="data[tel]" value="電話暗号は入力できません" />
  19.  
  20.     <div><img src="/resource/icons/comment.gif" /></div>
  21. </div>