How to make my button do not lose functionality after adding it with append in jquery

1

With this I add a row to my table this row contains data and buttons. But the buttons stop working I have to reload the page to work.

How do I make it work without reloading the page and after adding it with append?

$("tbody#agregarusuario").append('<tr><td><input id="obtenerid" type="number" value="'+obj.id_usuario+'" hidden>'+obj.nombres+'</td><td>'+obj.apellidos+'</td><td>'+obj.correo+'</td><td>'+obj.id_tipo_usuario+'</td><td>'+obj.habilitado+'</td><td><a class="waves-effect waves-light btn modal-trigger" href="#modal'+obj.id_usuario+'" style="border-radius: 34px;height: 50px;"><i class="material-icons left" style="margin-right: 0px;position: relative;top: 6px;">edit</i></a></td><td><div id="eliminarusuarios" name="btn_eliminar" class="waves-effect waves-light btn" style="border-radius: 34px;height: 50px;"><i class="material-icons left" style="margin-right: 0px;position: relative;top: 6px;">close</i></div></td>');  
    
asked by Alberto Julio Arce Escolar 18.08.2018 в 16:05
source

1 answer

2

uses the on method to assign the example events:

$('tbody').on('click',selector,function(){
    
answered by 18.08.2018 / 16:52
source