Uso do atributo data

by Diego Vieira

HTML

<table>
    <tr>
        <td data-nome="Lorem Ipsum">Nome attr data-</td>
        <td><button class="btn-danger">Recuperar nome</button></td>
    </tr>
</table>

JavaScript

$(function(){
    $(document).on('click', '.btn-danger', function(e) {
        e.preventDefault;
        var nome = $(this).parent().parent().find('td').data('nome');
        alert(nome);
    });
});