-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrabalhando-com-DOM.html
More file actions
26 lines (23 loc) · 953 Bytes
/
trabalhando-com-DOM.html
File metadata and controls
26 lines (23 loc) · 953 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
<html>
<head>
<title>Curso javascript</title>
</head>
<body>
<div id = "app">
<input type = "text" name = "nome" id= "nome" class = "nome"/></br>
<input type = "text" name = "nome2" id= "nome2" class = "nome2"/>
<button class = "botao">Adicionar</button>
</div>
<script>
var inputElement = document.getElementsByClassName("nome");
var inputElement2 = document.querySelector('div#app input');
var inputElement3 = document.querySelector('input[name=nome]');
var inputElement4 = document.querySelector('input[name=nome2]');
var btnElement4 = document.querySelector('button.botao');
btnElement4.onclick = function(){
var texto = inputElement3.value + " " + inputElement4.value;
alert(texto);
}
</script>
</body>
</html>