1
Good evening. I have a js where I need it executed when loading the page. It works when I click, but I cannot make the calculation automatically when loading the page.
$(document).ready(function(){
executa5();
$(".cubagem, .tabbable").on('click mouseover load', executa5);
function executa5(){
valorTotaldaNota = $("#valorTotaldaNota").val();
valorTotaldaNota = valorTotaldaNota.replace(".", "");
valorTotaldaNota = valorTotaldaNota.replace(",", ".");
adValorem = $("#adValorem").val();
gris = $("#gris").val();
v1 = valorTotaldaNota * adValorem / 100;
v2 = valorTotaldaNota * gris / 100;
v1v2 = v1+v2;
$("#valordoSeguro").val( v1v2.toFixed(2) );
};
});
What am I doing wrong?
verified the element inspector to see if no error occurred?
– Guilherme Nascimento
declares its function
executa5
out of the . ready– Maicon Carraro
@Maiconcarraro Put this as an answer
– Edgar Muniz Berlinck
is just a suggestion, if you solve I turn in response :)
– Maicon Carraro
I did, but it didn’t work.
– Tiago
Did you do what William said? Probably your job is making a mistake and you’re stopping
– Maicon Carraro
As I check on the inspector to see if there are any mistakes?
– Tiago
Right-click, inspect element, will open a stops looking for the console tab and analyzes errors.
– Maicon Carraro
There is no mistake appearing in the inspector
– Tiago