1

I'm having a trouble printing list of strings in django template: Here is template:

{% for column in columns %}
   alert({{column}});
{% endfor %}

size of columns is 3 and its ok. If i put alert("aaa"); then alert is shows 3 times. And if i write alert({{column|length}}); alert show 3. Why i cannot display column value like in code above?

I'm tried and alert(column); and alert({{column|safe}}); and nothing...

1 Answer 1

2

Just put it into quotes:

{% for column in columns %}
   alert("{{column}}");
{% endfor %}
Sign up to request clarification or add additional context in comments.

1 Comment

Oh my god O.o :) Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.