Как сравнить значение input с полем объекта в шаблоне django?
Я хочу сравнить значение поля объекта со значением input, которому я задал значение с помощью jQuery, по событию click.
Вот функция jQuery:
<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>
Я хочу получить доступ к значению input с id="map-value" с id поля объекта, к которому я обращаюсь с помощью цикла for следующим образом
<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 %}