0
I am having a problem creating a function in java script that needs to be executed in a file but this calling several times the same function when I try to put the function in input does not work follow the code:
<form class="myform" onkeydown="ProdUpCad()">
<input type="hidden" name="id" value="<?php echo $prod->id_prduto ?>">
// esta h1 se transforma em input
<h1 class="card_prod__title text-white editable-area"><?php echo $prod->nome_prod?></h1>
</form>
my func.js
function ProdUpCad() {
$("form.myform").on("focusout", function(e) {
var form = $(this);
var url = form.attr('action');
e.preventDefault();
$.ajax({
type: "POST",
url: "update/update_prod_name.php",
data: form.serialize(),
success: function(data) {
}
});
});
}
the problem is that when I do it doesn’t work anymore
– Daniel Ricardo
Place the focusout function on the loading of your page, inside the script tag. It is important that it is not inside any function. Also try inside the Document ready (https://learn.jquery.com/using-jquery-core/document-ready/)
– Leonardo Buta
it worked you could help me with one more question?
– Daniel Ricardo
Of course, please create a new question =)
– Leonardo Buta
I created this la ja
– Daniel Ricardo
https://answall.com/questions/433698/como-especificar-o-campo-input-clonado-js
– Daniel Ricardo