1. <!doctype html>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5.     <title></title>
  6. </head>
  7. <body>
  8. <li>
  9. <div class="vt-el-inner">
  10.     <div class="inner-logo">
  11.         bai<img src="../PPIMG/001.jpg">
  12.     </div>
  13.     <div class="inner-title"><span>1</span>马格du全屋定制</div>
  14.     <div class="inner-btn">
  15.         <div class="vote-count fl">7899票</div>
  16.         <button class="vote-send fr" onclick="asd(this)">投TA一票</button>
  17.     </div>
  18. </div>
  19. </li>
  20. <li>
  21. <div class="vt-el-inner">
  22.     <div class="inner-logo">
  23.         <img src="../PPIMG/002.jpg">
  24.     </div>
  25.     <div class="inner-title"><span>2</span>马格全屋定制</div>
  26.     <div class="inner-btn">
  27.         <div class="vote-count fl">789票</div>
  28.         <button class="vote-send fr" onclick="asd(this)">投ta一票</button>
  29.     </div>
  30. </div>
  31. </li>
  32.  
  33. <script type="text/javascript" src="jquery-3.2.1.js"></script>
  34. <script type="text/javascript">
  35.     function asd(obj){
  36.         //siblings 这个是遍历获取,如果不需要遍历,可以去掉这个节点
  37.         var ret = $(obj).parent().siblings(".inner-title").find("span").html();
  38.         console.log(ret)
  39.     }
  40. </script>
  41. </body>
  42. </html>

12-16 22:17