Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
HTMLElement: Evento change does´t works

I've used this code on the page and it doesn't work in the browsers I've tried it on. Can you help me correct the error?

<label>Elija un sabor de nieve:
    <select class="nieve" name="nieve">
        <option value="">Seleccione Uno …</option>
        <option value="1">Chocolate</option>
        <option value="2">Sardina</option>
        <option value="3">Vainilla</option>
    </select>
</label>

<div class="resultado"></div>
<script>

const selectElement = document.querySelector('.nieve');
selectElement.addEventListener('change',(event) => {
    const resultado = document.querySelector('.resultado');
    resultado.textContent = 'Te gusta el sabor ${event.target.value';
    });
</script>

This line show an error: "selectElement.addEventListener('change',(event) => {". When selecting an item from the dropdown, it should specify the selected item in text.In Dreamweaver it shows an error on the indicated lines and in Firefox it shows "Do you like the flavor ${event.target.value}".

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

const selectElement = document.querySelector('.nieve');
selectElement.addEventListener('change',(event) => { 
    const resultado = document.querySelector('.resultado'); 
  resultado.textContent = `Te gusta el sabor ${event.target.value}`;
});
<label>Elija un sabor de nieve:
<select class="nieve" name="nieve">
    <option value="">Seleccione Uno …</option>
    <option value="1">Chocolate</option>
    <option value="2">Sardina</option>
    <option value="3">Vainilla</option>
</select>
<div class="resultado"></div>

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda