jQuery之必会增删改查Dom操作

.next  .prev

    <button>change</button>
    <span class = '.demo'>aaa</span>
    <p class = '.demo'>bbb</p>
    <script src="./jquery.js"></script>
    <script>
      $('button').click(function(){
          $(this).next().css({fontSize:'20px',color:'orange'})
      })
      // next中可以传参数  如:next('p') 如果下一个兄弟元素节点不是p则不显示
      //prev 同理 next

猜你喜欢

转载自www.cnblogs.com/tianya-guoke/p/10527559.html
今日推荐