How to open a Modal, in CRUD of data with jQuery

1

I have a CRUD of DATA, in which I try to do something interactive with jQuery:

This is the part of the table, in which it contains the data, and its buttons to edit, see etc.

<td><input type="checkbox" name="check"></td>
<td>' .$row[npedido]. '</td>
<td>' .$row[fecha]. '</td>
<td>' .$row[cod_cliente]. '</td>
<td>' .$row[nombre_cliente]. '</td>
<td>' .$row[referencia]. '</td>
<td>' .$row[detalles]. '</td>
<td>' .$row[tipo]. '</td>
<td><i id="'.$row[npedido].'" class="fas fa-edit"></i></td>
<td><i class="fas fa-eye"></i></td>
<td><i class="fas fa-print"></i></td>
<td><i class="fas fa-trash-alt"></i></td>

I am trying with the edit button, to which I have assigned, to the edit icon, the "id" of the corresponding request.

What do I try to get now? * That when you click, a "Modal" with the data to edit opens.

The modal, I already have it ready.

  • I've tried some things with jquery, like trying to call it from class, but it does not work for me:
$( ".fa-edit" ).click(function() {
  $('#editarPedido').show();
});

Any advice, recommendation or contribution?

Thank you very much!

    
asked by Javier Avila Fernandez 29.08.2018 в 13:33
source

1 answer

1

I have found the solution in the following way:

  

$ (document) .on ('click', '.edit', function () {
  $ ('#EditOrder'). show (); });

Simply, I modified the jQuery a bit, to access the edit class with a click.

This class I have added in the php of the query as follows:

<td><i id="'.$row[npedido].'" class="fas fa-edit editar"></i></td>

I hope that someone else can also help you.

    
answered by 29.08.2018 в 13:49