JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<input id="inputPergunta" value="Como excluir figurinhas do WhatsApp?" />
<button onclick="fazerPergunta()">
Perguntar
</button>
<div id="resposta">
</div>
</div>
JavaScript
const elementoResposta = document.querySelector('#resposta')
const inputPergunta = document.querySelector('#inputPergunta')
const faqList = [
'Segure com o dedo na figurinha do WhatsApp e depois clique em remover',
'Clique na Play Store, depois digite na parte superior o nome do Aplicativo que vocĂŞ quer baixar',
];
function fazerPergunta() {
let resp = null;
if (inputPergunta.value === 'Como excluir figurinhas do WhatsApp?') {
resp = faqList[0];
}
elementoResposta.innerHTML = resp;
setTimeout(() => {
elementoResposta.style.opacity = 0
}, 5000);
}