3
I have a variable that has the resulting value of a function, I need to use that same value in another function.
Ex:
el1.on('change', function'){
//função pra trazer o valor que quero
var IdResult1 = 123 //valor que a função acima trouxe
$('.meuLink').attr('href','?parametro1='+idResult1)});
el2.on('keyup', function'){
//Outra função pra trazer outro valor
var idResult2 = 456 //valor que a função acima trouxe
$('.meuLink').attr('href','?parametro1='+idResult1+'¶metro2='+idResult2); // quero usar a variavel aqui
});
Ball show, it worked but the stranger I had tried before using var idResult1 = ""; didn’t work and leaving so it worked :D Thanks!
– Steve Angello
It must work by assigning an initial value as well, as long as it is outside the function.
– bfavaretto