Created
November 10, 2021 21:44
-
-
Save brunokunace/9d5d39e9c2258d97f7189760cda13e95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<input type="text" id="nomeCliente"> | |
<button type="button" onclick="adicionar()">adicionar clientes</button> | |
<h3>Lista de clientes</h3> | |
<ol id="listaClientes"> | |
</ol> | |
<script> | |
function adicionar() { | |
const inputName = document.getElementById('nomeCliente').value | |
adicionarNaLista(inputName) | |
} | |
function adicionarNaLista (nome) { | |
const lista = document.getElementById('listaClientes') | |
const cliente = document.createElement('li') | |
cliente.appendChild(document.createTextNode(nome)) | |
lista.appendChild(cliente); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment