Hide a table after the click

0

I have a table that lists the clients of a company. The user selects the client he wants through the links in each. Clicking the data in the table feeds the inputs of the form. But now I want to hide the table, since the user has already selected the record he would like.

The table I'm ready to do:

<table class="table" id="tabelaCliente">

        <tbody>
        <tr>
            <th>
                <i>
                    Cliente
                </i>
            </th>
            <th>
                <i>
                    Telefone
                </i>
            </th>
        </tr>
        <?php
        foreach ($query as $linha) {
        ?>
            <tr>
                <td id="<?php echo $linha->id ?>"> <a href=""><?php echo $linha->nome ?></a></td>
                <td><?php echo $linha->telefone . ' ou ' . $linha->celular ?></td>
            </tr>
        <?php
        }
        ?>
        </tbody>
</table>

To feed the inputs of the form I use AJAX:

$(document).on("click","#tabelaCliente td a",function(e){
    e.preventDefault()
    var id_cliente = $(this).parent().attr("id");

    $('#nome').val($(this).text());
   // para ocultar eu faço
    $('#tabelaCliente').hide('slow');
    // já tentei isso também
   // document.getElementById('tabelaCliente').style.display = "block";

});

My problem is to hide the table, it will not ... Does anyone know how to do it?

    
asked by anonymous 09.01.2018 / 14:15

1 answer

0

I think this answer is just what you need:

$('#tabelaCliente td a').click(function() {
    //o que precisar fazer..

    $('#tabelaCliente').toggle('slow');
});
    
09.01.2018 / 14:23