-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
28 lines (21 loc) · 877 Bytes
/
script.js
File metadata and controls
28 lines (21 loc) · 877 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
const apiKeyInput = document.getElementById('apiKey');
const gameSelect = document.getElementById('gameSelect');
const questionInput = document.getElementById('questionInput');
const askButton = document.getElementById('askButton');
const aiResponse = document.getElementById('aiResponse');
const form = document.getElementById('form');
const enviarFormulario = async (event) => {
event.preventDefaut();
const apiKey = apiKeyInput.value;
const game = gameSelect.value;
const question = questionInput.value;
console.log({apiKey, game, question});
if (apiKey == '' || game == '' || question == '') {
alert('Por favor, preencha todos os campos');
return;
}
askButton.disabled = true;
askButton.textContent = 'Perguntando...';
askButton.classList.add('loading');
}
form.addEventListener('submit', enviarFormulario);