【问题标题】:jQuery Parent Sibling sourcejQuery 父兄弟源
【发布时间】:2014-08-29 12:54:21
【问题描述】:
<div id="cell">
   <div class="choose">
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td colspan="2"><h3>Title</h3></td>
         </tr>
         <tr>
            <td align="right"><a href="#" class="ex">CLICK HERE</a></td>
         </tr>
     </table>
   </div>
   <div class="result">
      <img src="images/blank.jpg" width="72" height="72">
   </div>
</div>

这是我的 HTML,我点击 (a.ex) 并能够修改 (div.result img) 的 img scr 的正确组合是什么>?

【问题讨论】:

  • 如果您使用的是 jQuery,那么如果您使用粗体字作为选择器,那么您将非常接近它自己...

标签: javascript jquery html jquery-selectors siblings


【解决方案1】:

认为这就是你要找的东西:

$(this).closest('div.choose').next('div.result').find('img')

您的问题有点含糊,正如cmets中提到的Blunderfest,您可以直接使用div.result img选择图像

【讨论】:

    猜你喜欢
    • 2011-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-10
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    相关资源
    最近更新 更多