jQuery兄弟姐妹()/next()不';我不在IE工作

jQuery兄弟姐妹()/next()不';我不在IE工作,jquery,Jquery,这个jQuery脚本在firefox上工作,它会发出警报。 但它在IE7中不起作用。你知道哪里出了问题吗 标记: <td class="tdnotes"> <a title="" class="notes" id="order-1" href="#"> <!-- an image --> </a> <div style="display: none;" id="wr

这个jQuery脚本在firefox上工作,它会发出警报。 但它在IE7中不起作用。你知道哪里出了问题吗

标记:

<td class="tdnotes">
  <a title="" class="notes" id="order-1" href="#">
   <!-- an image -->
  </a>                              
  <div style="display: none;" id="wrap-order-1" class="thenotes">
   <!-- text area, input elements -->
  </div>
 </td>

大概是因为sides()将为您获取一个集合,所以您需要循环匹配的元素:

$("a.notes").click(function() {
    $(this).siblings().each(function() {
        alert($(this).attr('class'));
    });
    return false;
});

它在Firefox和IE7中都能正常工作-这里有一个和您的代码


是正确的,这将获得一个集合,但链接到
sibbins()
将获得匹配集中第一个元素的指定属性。由于
或是否在ready()或load()中添加了单击处理程序?是的,它在IE7中工作。事实证明,还有其他一些因素使得这不起作用。谢谢
$("a.notes").click(function() {
    $(this).siblings().each(function() {
        alert($(this).attr('class'));
    });
    return false;
});