Skip to content

Instantly share code, notes, and snippets.

View huannvictor's full-sized avatar
🤓
Working from home

Huann Almeida huannvictor

🤓
Working from home
View GitHub Profile
@huannvictor
huannvictor / manipulando o DOM
Created July 1, 2022 21:27
manipulando o DOM
//* adicionar novo item
function newPhone() {
//* 1. seleciona o elemento que irá receber os novos filhos
const phoneGroup = document.querySelector("form#phones");
//* 2. cria os filhos
const newPhoneField = document.createElement("p");
const newPhoneLabel = document.createElement("label");
const newPhoneInput = document.createElement("input");
newPhoneInput.setAttribute("name", "phone");