1
Being a JS novice, I’m trying to concatenate the value of an input to a random value that I generated, as if typing the name generated a random user name for the person, I thought about saving the name to a function and then concatenating both, the problem is that I do not know how to make a function that saves the entered value. Someone willing to give a light?
Here are the functions I have so far, being function receber_nome()
the one I can’t quite put together.
function receber_nome()
{
}
function gerar_string_aleatoria( tam, charset )
{
var serial = "";
for( var i = 0; i < tam; i++ )
serial += charset.charAt( Math.floor(Math.random() * charset.length) );
return serial;
}
function gerar_serial()
{
return receber_nome() + gerar_string_aleatoria( 4, "0123456789" );
}
You don’t need a function to take the name, just take the value of an input for example in which the person typed the name and concatenate with the generated value.
– LeAndrade
@Leandrade, you say using a Getelementbyid in the case?
– Natã Minetto
This very thing Nathan.
– LeAndrade