日期:2014-05-16  浏览次数:20400 次

jquery内元素找外元素
<div>
  <table>
       <tr>
           <td>
                <a href='javascript:removeDIV(this) '>
                         <img src=".....">
               </a>
          </td>
     </tr>
  </table>
</div>

<div>
  <table>
       <tr>
           <td>
                <a href='javascript:removeDIV(this) '>
                         <img src=".....">
               </a>
          </td>
     </tr>
  </table>
</div>

请问removeDIV(this)   怎么样才能删除点击DIV
------解决方案--------------------
function removeDIV(obj){
    $(obj).closest('div').remove();
}
------解决方案--------------------
用 $(obj).parents("div").remove()