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

194
Visualizações
How to compare the value of an input with an object field in django template?

I want to compare the value of an object field to the value of an input that i have set the value with jQuery on a click event.

Here is the jQuery function:

<script>
    $(document).ready(function()
    {
        $('.position').click(
            function(){
                var id=$(this).attr('id');
                alert(id)
                $('.info-tooltip').toggleClass("hidden");
                $('.header').addClass("popup");
                $('.section').addClass("popup");
                $('#map-value').val(id);
            },
        )
        $('.remove-link').click(
            function(){
                $('.info-tooltip').addClass("hidden");
                $('.header').removeClass("popup");
                $('.section').removeClass("popup");
            },
        )
    });
</script>

I want to access the value of the input with the id="map-value" with the id of the object field that I am accessing it with an for cycle like this

<form>
     <input type="text" value="1" id="map-value" name="map-value">
</form>
{% for p in points %}
   {% if p.id == form.input.value %}
     //i will show sth here
   {% endif %}
 {% endfor %}

about 4 years ago · Juan Pablo Isaza
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