Hello
I need to make a button that when it clicks it automatically fills in the input fields.
HTML
<button type="button" id="botao">Auto</button>
<input type="text" id="nome">
<input type="text" id="sobrenome">
JS
$(document).ready(function() {
var nome = "Joãozinho";
var sobrenome = "Fulano";
$("#botao").click(function(){
$("#nome").val(nome);
$("#sobrenome").val(sobrenome);
});
});
But when you click the button nothing happens, what is wrong with the code?