-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodulo2.js
More file actions
28 lines (22 loc) · 950 Bytes
/
modulo2.js
File metadata and controls
28 lines (22 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
* No HTML tinha essa div, por isso estavamos manipulando direto no index.html
* <div id="app">
* <input type="text" name="nome" />
* <button class="botao">Adicionar</button>
* </div>
*/
const inputElement = document.querySelector('input[name=nome]');
const inputElementAll = document.querySelectorAll('input');
console.log(inputElement);
console.log(inputElementAll);
const inputElementValue = document.querySelector('input[name=nome]');
const btnElement = document.querySelector('button.botao');
btnElement.onclick = function(){
alert('Botão clicado');
}
const linkElement = document.createElement('a');
linkElement.setAttribute('href', 'https://github.com/yankasantos');
const textElement = document.createTextNode('Conheça o meu Github ^⁻^');
linkElement.appendChild(textElement);
const containerElement=document.querySelector('#app');
containerElement.appendChild(linkElement);