javascript – How to call a js function in html

Well I'm not sure but I think the mistake is in the way I call the js function. Here is the code:

createdCell: function (td, cellData, rowData, row, col) {
// td: the column in question
// cellData: entire data
// rowData: integer row data
// line: line index
// col: column index


$ (td) .html (`Edit`);
}

That way, when I open the page, it already opens the modal of change that should only be triggered when the button is clicked.
Function code that I am calling:

var edit = function (data2, row2) {
var data = dt.data ();
console.log (data2);
console.log (line2);
$ (#AlterarModal) .modal ();
for (var i in the data) {

if (i == line2) {
$ (# #_Name) .val (data2.name);
$ (#Val_siape) .val (data2.siape);
$ (# #_Cpf) .val (data2.cpf);
$ (## alt_funcao) .val (data2.funcao);
$ (# #_Codigo) .val (data2.codigo);
$ (# #Val_nivel) .val (data2.level);
$ (# #_Unit) .val (data2.unit);
$ (# Alt_portaria & # 39;) .val (data2.portaria);
$ (## alt_publication) .val (data2.publication);
$ (# #_Deresso) .val (data2.ingresso);
$ (#Val_exoneration) .val (data2.exoneration);
$ (# #_Sub_name & # 39;) .val (data2.subname);
$ (# #_Sub_siape) .val (data2.subsiape);
$ (# #_Sub_cpf) .val (data2.subcpf);
$ (# #_Sub_ingresso #); .val (data2.subingresso);
$ (# #_Sub_exoneration) .val (data2.subexoneration);
$ (# #_Sub_publication) .val (data2.subpublication);
pause
}
}