0
Hello
I need to make a button that when clicking it automatically fills 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 clicking the button nothing occurs, the is wrong in the code?
The code works. Confirm that you have jquery correctly added to the page.
– Isac
Really missed jquery, thank you so much for helping :)
– Junior