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

218
Visualizações
How to get updates from the input field in Django

I have this code in template

{% block content %}
<script>
    function onChange(event) {
        console.log("log")
    }
</script>
<h3>List</h3>

<input type="text" placeholder="Filter by..." onchange="onChange(event)" value={{ searching_value }} >

But it doesn't seem to work..

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The value from the event should be accessed via event.target.value as per the MDN docs. You can't access this.value how you are. onChange should accept an event argument and you pass the reference to the function for the onchange attribute.

about 4 years ago · Juan Pablo Isaza Relatório

0

As @schillingt mentioned, the argument of onChange is a Event. So you should treat it like one :)

{% block content %}
<script>
    function onChange(event) {
        console.log(event.target.value)
    }
</script>
<h3>List</h3>

<input type="text" placeholder="Filter by..." onchange="onChange" value="{{ searching_value }}"/ >
about 4 years ago · Juan Pablo Isaza 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