closest Find

by suraj mahajan

HTML

<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<table title="outer">
   <tr>
      <td>
          
<table title="inner">
   <tr>
       <td>
          <input type='button' id='Sample1' data-type="one" title='one' />
       </td>
      <td>
          <input type='button' id='myId' />
      </td>
   </tr>
</table>
<table title="sibling">
   <tr>
      <td>
      </td>
    </tr>
</table>

      </td>
   </tr>
</table>

JavaScript

alert($('#myId').closest('table').find('[data-type="one"]').attr('title'));